Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

PHP agent 9: serious memory leak issues


#1

Hi Explorers,

Over the weekend, we’ve started seeing very high memory usage of our PHP applications, particularly in long-running PHP non-web transactions. After a while of investigation, we’ve narrowed the problem down to the New Relic PHP agent update. If we pass the PHP flag to disable it with PHP’s -d option then the leaks vanish.

We’ve tried different New Relic settings, thinking the culprit might be transaction trace data, but only disabling the agent entirely seems to mitigate the leaks. Downgrading to the previous 8.x version fixes the problem for us.

To paint a picture of the severity of these leaks, I’ve seen a process that normally uses like 100-120MB use up 1.5 gigabytes of memory. Another process used up all 8GB of RAM on the server and 2GB of swap space, forcing me to stop the VM and double its memory to prevent further production incidents.

Other folks have mentioned segfaults, here we’ve got memory leaks - perhaps writing sections of the agent in Rust might be something the team could look into.

This is actually not the first time we’ve seen issues like these in the New Relic PHP agent, and as a result, we have become hesitant to deploy NR PHP agent package updates in production. I have found the NR team very responsive to fixing things like these in the past, after submitting a support ticket, but I no longer have the means to do so.

So YMMV but if anyone has the latest PHP agent installed, and is running background tasks, my tip would be to check for increased memory usage on your servers.

Toon Spin


#2

Hi @toon.spin - It could be related to this known issue.


#3

Hi @stefan_garnham, I’d seen that post and I agree it seems likely to be related - after all they are both typically symptoms that are caused by bugs relating to memory/pointers. Perhaps it’s a single bug that’s causing both segfaults and leaks. That sort of bug can be pretty subtle and difficult to spot.

That said, I haven’t seen anyone else post about memory leaks, so I felt it would be good to let the community know that this might be a thing.


#4

I haven’t seen any memory leak issues relating to the PHP 9.0 agent. Only Seg Faults.

Agent 9.0 has been rolled back, and currently we recommend you utilise agent 8.7 for now.

With all that said, I would like the development team to review the details you shared, so I’ll open up a ticket for you - so our PHP experts can look into this.


#5

Have had both leaks and segfaults.


#6

Thanks for letting us know - @jarret

Would you be willing to try out the new patched agent: