XF 1.5 Hourly Cleanup cron creating OOM errors: from image proxy?

kontrabass

Well-known member
My hourly cleanup task run at :10 after every hour is creating a php fatal error every time:

(ErrorException: Fatal Error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 2097152 bytes) - library/XenForo/Model.php:223)

I'm not sure, but I SUSPECT that it's because I recently changed my "Image Cache Lifetime" setting from 0 (unlimited) to 30 days. My image cache has well over a million images. Maybe the hourly cleanup is running out of memory trying to clear out my image proxy cache? Is there a better way to trim down the image proxy cache?
 
That does sound feasible as a cause but at the same time it might be something we need to optimise.

My only thought for a workaround now is if you're able to increase the lifetime higher than 30 days.

Not sure what the max is but try 90 and see if that runs. Increase it by 30 or so each time until the Cron can run. Once it does run, decrease it again and run the cron again and keep doing that in intervals until, hopefully, it handles running at 30 days ok.

Meanwhile I'll check to see if we can improve anything here. So you have the full stack trace of he server error too?
 
That does sound feasible as a cause but at the same time it might be something we need to optimise.

My only thought for a workaround now is if you're able to increase the lifetime higher than 30 days.

Not sure what the max is but try 90 and see if that runs. Increase it by 30 or so each time until the Cron can run. Once it does run, decrease it again and run the cron again and keep doing that in intervals until, hopefully, it handles running at 30 days ok.

Meanwhile I'll check to see if we can improve anything here. So you have the full stack trace of he server error too?

That's a good idea. I'll try 90 and see if that works. Here's the full error:

Code:
ErrorException: Fatal Error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 2097152 bytes) - library/XenForo/Model.php:223
Generated By: Unknown Account, Yesterday at 10:10 PM
Stack Trace
#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}
Request State
array(3) {
  ["url"] => string(37) "https://www.talkbass.com/deferred.php"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(3) {
   ["_xfRequestUri"] => string(40) "/forums/for-sale-effects-and-pedals.213/"
   ["_xfNoRedirect"] => string(1) "1"
   ["_xfResponseType"] => string(4) "json"
  }
}
 
Top Bottom