Improve error reporting when OOM occurs

Xon

Well-known member
Affected version
2.2.6
Currently XenForo can essentially hard falls over when an OOM error occurs, and fails to log OOM errors.

There are strategies to work-around (discussed here);
  • Pre-reserve a chunk of memory at startup
  • In the shutdown handler;
    • Try call ini_set('memory_limit') with a higher limit.
    • Release the reserve and/or clear various caches before any operation which could allocate. (including other function calls!)
This doesn't work in all cases, but it would work in a large number of them.

Frameworks like laravel also implement some of these workaround.

Works; OOM due to allocation; https://3v4l.org/Xuun2
Some what works; OOM due to stack exhaustion; https://3v4l.org/K2Uq4
 
Last edited:
Back
Top Bottom