-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible memory leak #216
Comments
Thank you @boncea. Try disabling some features of the bundle one by one. Always when taking about memory leaks, then Monolog is a usual suspect. Especially if you use "fingers_crossed" strategy with long running processes. |
My first suspect was also monolog, but it still happened with it disabled. In the end, I had only http enabled and it still happened. After more digging into the bundle code, I ended to the conclusion that it needs to be related to setting the application name. More specifically, when the interpreter I didn't find any more information from newrelic side about what "discarding" of the transaction would mean, but I'm pretty much sure that they don't actually remove it instantly. I enabled debug and monitored some logs for newrelic and I've seen logs like Initially I tried to fix this in my fork, by ending the transaction before setting application name, like this (in https://github.com/ekino/EkinoNewRelicBundle/blob/master/Listener/RequestListener.php#L79):
Surprisingly for me, this didn't fix the issue, so now I think there are two possible reasons:
After I changed the config to not set the app name from there, but directly through ini file, the memory seems to stay quite flat again (I'll confirm after it runs for some more time). |
Hm. Maybe @astorm could help us a little here. |
@Nyholm @boncea Happy to take a look -- based on what I'm reading above I see three possible sources for the leak
Nothing immediately pops out as a known issue -- so I have a few questions.
Could you talk a bit more about what led you to this conclusion? Or would it be possible to share some base-level reproducible test case? (i.e. Symfony + EkinoNewRelicBundle + [small bit of code], or even better [some small bit of code with the agent]. |
@boncea we did some testing this week and wern't able to recreate your issue with a stock Symfont 4.2 system using either the built in web server, or PHP-FPM. So if this is the agent's issue, it's some combination of non-stock PHP + the Agent that's causing the issue. Without more information we're at a bit of standstill. If you can provide a reproduction (Docker container?) where the problem occurs that would be super useful. Lacking that -- OS name/version, PHP version, and which PHP SAPI with which web server would be useful details to help us track this down. Also, if you solved the problem yourself we'd love to know what you did. Thanks! |
As I mentioned before, with the bundle disabled and with the agent enabled, the leak doesn't happen.
With the above config, we have only
Unfortunately I cannot provide the dockerfile, but I use the following: |
@boncea I've carved out some time to work on tracking this down this week, so hopefully we can get to the bottom of it. You're not the first person to report fishy behavior with I've reproduced the environment you mentioned above in EC2 (using PHP 7.2.17 instead of php 7.2.16) with a simple Symfony Controller that renders a twig endpoint. I'm driving traffic at that endpoint, and none of the PHP-FPM processes seem to be using an unusual amount of memory. If possible, can you share the php extensions you're using (a phpinfo page should do that). Can you talk a little bit about what your application does? Like -- is it making database queries? Working with other datastores? Are you using other New Relic API methods during the same request ? Do you know if it's the php-fpm processes that are eating up memory? Tracking down these sorts of "don't happen for everyone" memory leaks and segmentation faults usually comes down to needing to reproduce the issue, so if there's any additional information you can share. I'm also on the Symfony Slack if you want to reach out there and avoid the long communication cycles. |
I have a
Answering to you other questions, I don't use any other NewRelic API methods than the ones from Ekino which I described previously. The application runs inside docker and the docker image extends the official
@astorm I'll contact you on slack so that you can ask me other details. |
👋 The slow motion train continues on this one. The team's found some possible memory handling problems around the edges of the New Relic daemon -- specifically with daemon restarts while an application's under heavy load. These may be the culprit for the above leaks. It's my understanding the team's planning a fix for a future (hopefully the next) agent release. I'll keep you'all posted as progress continues. (Something something spinning plates). Thanks for bringing this to the team's attention, it probably wouldn't have been caught otherwise! |
@Nyholm @boncea Hello! It's been 23 days, but we're back. There's been a new release of the PHP Agent for New Relic that fixes up some problems with memory handling around transaction start/stop -- specifically to address problem with I have a working theory that this may also provide a fix for the strange memory usage patterns described above. @boncea -- if we haven't lost the thread, I'm wondering if you could run your tests with the newest version of the PHP Agent and see if they clear up the memory leak you described earlier. |
Recently I had to investigate a memory leak in our system. Tracking it down, we realized that it's related to newrelic. After more investigation it seems like it's related to this bundle, but I didn't find yet what exactly is causing it. I have to mention that I'm using symfony 4.2.
Here is my configuration:
Here is a graph with memory consumption in Amazon ECS:
The first part of the graph is with the configuration from above, the second small flat part is with both newrelic extension and ekino bundle disabled and the last flat part is with newrelic extension enabled and bundle disabled.
I'll continue investigating it, but please comment here if you have any idea.
The text was updated successfully, but these errors were encountered: