WordPress 4.9.8 Will Significantly Reduce Memory Leak

WordPress 4.9.8 Beta two recently shipped and although much of the focus will be on the “Try Gutenberg” call-out, there’s a patch included that addresses a memory leak that was quite a problem for some users.

When WordPress 4.9.7 shipped, the WordPress.org support forums saw an increase in reports of memory exhausted errors due to the wp_is_stream function.

The bug is actually in PHP and is related to the stream-get-wrappers function. WordPress 4.9.7 increased the number of times it calls the wp_is_stream() function generating the error more often.

After thoughtful conversations within the trac ticket, a patch was created that after further testing, was committed to core. According to Gary Pendergast, the patch does the following.

Bailing if the path isn’t a stream. This isn’t perfect: it’s still possible to trigger the PHP bug, but it does significantly reduce the chances of the bug being encountered. For many WordPress sites (those that don’t have plugins that use streams), it reduces the chance to zero.

If you encountered memory exhaustion errors after installing or upgrading to WordPress 4.9.7, try WordPress 4.9.8 Beta 2 to see if it fixes the issue.

Aside from coming up with a solution, Trac ticket #44532 is a bit refreshing to see. In open source, tickets or issues can get bogged down with suggestions, hypothetical scenarios, and bike-shed commentary.

In this instance, the issue was identified and folks from the community along with core contributors worked together in a focused fashion to create a fix in time for the next point release. The ticket is a good example of what it’s like when open source is firing on all cylinders. 


3 responses to “WordPress 4.9.8 Will Significantly Reduce Memory Leak”

  1. Thanks for reporting this Jeff. For about 10 days this bug was making me crazy… this is what I encountered in the process.

    – My sites at Godaddy shared hosting with php 5.6 had no problems, so as my test sites at poopy.life.

    – On my development localhosts using Ampps php 7.1, the server was crashing at least once every minute or, so, and almost immediately after visiting the theme Customizer. Downgrading the php to 5.6 helped a bit, but did not solve the whole issue, but the sites slowed down a lot. After deleting Ampps and Re installing it in a different folder, things did NOT get any better. I must have installed a WP site 50 times with different settings and plugins with no avail. Mind you that this was happening on all 3 Windows 7 computers that I was using. As a theme and plugin developer I started questioning if any of my code was causing the issue, which I had to really comb things for hours, almost line after line looking for clues…

    – Finally, I gave up on Ampps, and installed Xampp, which solved all the crashing issues. Xampp comes with php 7.2 which of course comes with the not countable warning, and I guess that warning in the future will be upgraded to an error message. Thankfully the fix for that warning was an easy one for my themes, and life was good again.

    On Tuesday, when the WP 4.9.8 beta1 came out along with the news of the memory leaks in WP, I was relieved… 10 days to hell and back, but I learned a lot in the process, like cursing at your computers, things don’t get fixed magically ! I got the beta 2 yesterday, but I still did not test it for memory leaks on my Ampps installations yet, that’s next on my agenda I guess !

    Thanks again Jeff.

  2. It’s not a memory leak, really, it just presents that way. It’s really a memory corruption issue that seems to only present in certain versions, using Windows hosting and Apache. Odd one, certainly. I was unable to find detailed info about the specific php bug, just reports closed years ago.


Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: