Jump to content

Allowed memory exhausted...tried to allocate


Recommended Posts

I'm suddenly getting 500 server errors on a WordPress site. In the logs I'm getting;

PHP message: PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 68262447988 bytes) in /var/www/mysite.com/wp-includes/load.php on line 1357

That's 68 Gig that it's trying to allocate. Clearly this is a spurious message as nothing on the site is doing anything that requires anything like this much memory. I can restart PHP and load the page fine. When I try to refresh the page to load a second time, I get the error. It's the same regardless of the page I request. Always works first time, fails subsequent times.

What could be causing this?

 

Link to comment
Share on other sites

6 minutes ago, Barand said:

The most common cause I've experienced is a recursive process with no working exit strategy - infinite recursion.

I did have the thought of recursion. The error response from the server is almost immediate, and it doesn't explain why identical requests can succeed the first time and fail the second.

Link to comment
Share on other sites

I've done some more troubleshooting and the problems goes away if I disable opcache in php.ini. So it would appear that something is failing in a less than graceful way. I'll start testing increasing memory for opcache and see what difference it makes. To anyone else seeing this strange behaviour whereby a page loads successfully the first time, but not subsequent times, try disabling opcache and see if the problem goes way; if so, you know where to look.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.