XF 1.4 PHP Fatal error: Allowed memory size of 256MB exhausted in library/Zend/Db/Statement/Mysqli.php

imthebest

Well-known member
Hello,

Today I saw the following errors logged on my php.log file:

Code:
[13-Jan-2015 19:38:07 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 78 bytes) in /var/www/html/library/Zend/Db/Statement/Mysqli.php on line 304
[13-Jan-2015 19:38:23 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 78 bytes) in /var/www/html/library/Zend/Db/Statement/Mysqli.php on line 304
[13-Jan-2015 19:38:37 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 80 bytes) in /var/www/html/library/Zend/Db/Statement/Mysqli.php on line 304
[13-Jan-2015 19:39:07 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 78 bytes) in /var/www/html/library/Zend/Db/Statement/Mysqli.php on line 304
[13-Jan-2015 19:39:42 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 78 bytes) in /var/www/html/library/Zend/Db/Statement/Mysqli.php on line 304
[13-Jan-2015 19:40:13 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 1699 bytes) in /var/www/html/library/Zend/Db/Statement/Mysqli.php on line 294

Unfortunately XenForo didn't logged these errors on the Server Error Log so I don't have more information about these.

I'm using XF 1.4.4 and XFES 1.1.1

Thanks,
Super120
 
Last edited:
If you can find a user that causes semi-regular OOM, check their xf_user & xf_user_option entry and see if an addon has been dumping crazy amounts of data in there.
 
This problem isn't XenForo related but XenForo Media Gallery 1.0.2.

If you're interested you can follow up here: https://xenforo.com/community/threa...rors-when-viewing-user-profiles-random.91031/

It isn't XenForo Media Gallery related.

For anyone interested, this was in fact a bug on XFMG 1.0.2. Full details here: https://xenforo.com/community/threa...s-when-viewing-the-online-members-list.93213/

Special thanks to @Jim Boy and @Xon for their help.
 
I don't have the experience guys in this thread do, but this morning ... after only 3 days of having my forum, I too .. received this:

Fatal Error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 29772808 bytes)

Should I just delete it .. or? I just don't have the experience to dip into files trying to fix this - if it's even possible to fix that way. :/ Honestly, I never expected to have such things occur so early in the game. Just hope this waiting and wondering if something else will pop fades ...lol. Btw, I have no add ons at that moment and 4 members having signed in. The rest of my members are on stand by with registering ... until we get some of these types of things figured out and understood.
 
If there are no add-ons installed, it's likely not the same issue as reported here (albeit a similar error).

This message is saying that PHP has a memory_limit set of around 67MB and that limit has been exceeded.

67MB is quite low - the XenForo code actually takes steps to try and increase this limit programmatically to 128MB. The memory_limit is a PHP configuration in php.ini though it can also be overridden with some web servers.

Try and set the value in php.ini to something like 128M.

If you don't know how to do this, this is something your host should be able to change for you.

Was the error above logged in your XenForo Server Error Log? If so, was there any other detail such as a stack trace? If you have any more info aside from the error it may be useful.
 
If it helps, I once had the OOM issue even with a 512MB (I know, it's insane... just trying to figure out what's going on...) memory limit then found out that a buggy installation of PHP APC was causing this. Reinstalling it fixed the issue with 128MB limit.
 
@Chris D

Stack Trace:

#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}

Request State:

array(3) {
["url"] => string(113) "http://m3lforums.com/index.php?atta...f1e0969fdb31767ffb8e75946ac&content_type=post"
["_GET"] => array(3) {
["attachments/do-upload_json"] => string(0) ""
["hash"] => string(32) "561b2f1e0969fdb31767ffb8e75946ac"
["content_type"] => string(4) "post"
}
["_POST"] => array(4) {
["_xfToken"] => string(8) "********"
["_xfNoRedirect"] => string(1) "1"
["_xfSessionId"] => string(32) "28902335ddd10428ba02920df7849a98"
["content_data"] => array(1) {
["node_id"] => string(2) "55"
}
}
}
 
Do you have the maximum image dimensions option set in Admin CP > Options > Attachments?

If so, this is potentially a memory intensive process as it would need to dedicate a fair bit of memory to resize the image.

My solution probably still stands. You would need to look at raising the memory_limit from what it is currently to no less than 128M (256M or more might be better).
 
Yeah, I'l increase the memory_limit to 256. As for the maximum image dimensions, I have it blank. Is this OK or should it be set to a particular size? Also, I increased the attachment image file size as well. Is there a sweet spot # for this as well? If so, what?
 
Having it blank is fine. In which case the error must be happening when the image thumbnail is being created. Increasing the memory limit should solve the problem, though if the issue continues or you begin to get memory exhausted errors then that may indicate the file sizes you're allowing to be uploaded are too large.
 
Hi guys, I'm having similar issue with this, I tried to increase PHP memory_limit to 1024 MB but still doesn't help.

Code:
in /home/forum/domains/xenforo/public_html/library/Zend/Db/Statement/Mysqli.php on line 294\n'
[Mon Oct 23 18:06:06.059402 2017] [proxy_fcgi:error] [pid 6680:tid 139836140775168] [client 1.2.3.4:34159] AH01071: Got error 'PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 665 bytes) in /home/forum/domains/xenforo/public_html/library/Zend/Db/Statement/Mysqli.php on line 294\n'
[Mon Oct 23 18:06:08.188592 2017] [proxy_fcgi:error] [pid 6680:tid 139836065240832] [client 1.2.3.4:12495] AH01071: Got error 'PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 665 bytes) in /home/forum/domains/xenforo/public_html/library/Zend/Db/Statement/Mysqli.php on line 294\n'
[Mon Oct 23 18:07:01.961287 2017] [proxy_fcgi:error] [pid 6680:tid 139835888994048] [client 1.2.3.4:29891] AH01071: Got error 'PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 665 bytes) in /home/forum/domains/xenforo/public_html/library/Zend/Db/Statement/Mysqli.php on line 294\n'

This is XenForo 1.3.3 and I'm using php-fpm.

Any help would be appreciated.
 
It doesn't look like your memory_limit changes have applied as those errors are still showing a 128M limit.

Beyond that though, the previous comments about the difficulty of determining the cause just from a fatal error applies. If you can reproduce it consistently, that's a start.
 
Top Bottom