PHP OOM Errors with high memory limits

#1
Hi there ! I'm kind of hopeless right now... I've been looking through forums for days now with no solutions that seem to work for me.

I've migrated a WordPress site that uses an LMS plugin and BuddyBoss platform which seem to be pretty demanding from a shared hosting to a VPS.
The shared hosting used LiteSpeed server so I wanted to use OpenLiteSpeed so I would have less problems migrating.

The server specs are as follows:
- 8 CPU Cores @ 2.394Ghz
- 8GB of RAM
- Nvme Storage

Thing is, I keep having out of memory errors form php in stderr.log for example:

Code:
PHP Fatal error:  Out of memory (allocated 6291456) (tried to allocate 20480 bytes) in /usr/local/.../xxx.php on line x
Thing is, my memory_limit on php is set to 6144MB (I've tried increasing it to this value to try and see if it was the issue but seems like it's not.

Here is the config of "Server Configuration" -> "External App"

Screenshot 2022-03-16 at 10.09.42.png

I have some other logs that I don't really get in /usr/local/lsws/log/error.log:

Code:
2022-03-16 09:10:45.118504 [INFO] [239999] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2022-03-16 09:10:45.118522 [INFO] [239999] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2022-03-16 09:10:45.118598 [NOTICE] [239999] [LocalWorker::workerExec] Config[lsphp]: suExec uid 65534 gid 65534 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 65534 gid 65534, flags: 0.
2022-03-16 09:10:45.118992 [NOTICE] [239999] [lsphp] add child process pid: 240034
2022-03-16 09:10:45.119119 [INFO] [239999] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2022-03-16 09:11:12.490672 [NOTICE] [239996] [LocalWorker::workerExec] VHost:_AdminVHost suExec check uid 997 gid 65534 setuidmode 2.
2022-03-16 09:11:12.490719 [INFO] [239996] [LocalWorker::workerExec] VHost:_AdminVHost suExec check uid 997 gid 65534 setuidmode 2.
2022-03-16 09:11:12.490737 [NOTICE] [239996] [LocalWorker::workerExec] Config[AdminPHP]: suExec uid -1 gid -1 cmd /usr/local/lsws/admin/fcgi-bin/admin_php -c ../conf/php.ini, final uid 997 gid 65534, flags: 0.
2022-03-16 09:11:12.491359 [NOTICE] [239996] [AdminPHP] add child process pid: 240705
2022-03-16 09:12:03.028870 [NOTICE] [239996] sendKillCmdToWatchdog: 'extappkill:240705:-3:0'.
2022-03-16 09:12:03.800987 [NOTICE] [239994] Cmd from child: [extappkill:240705:-3:0]
2022-03-16 09:12:03.801064 [INFO] [239994] Failed to get process [240705] start time, not running, skip killing.
Does anyone have the same issue I have ? I don't really know what to do from here...

EDIT: My memory usage on the server never exceeds 1.5 - 2GB
 

Cold-Egg

Administrator
#2
Please edit /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini, and increase the memory_limit to e.g. 2048M. Then restart PHP with "killall lsphp" command
 
#3
Please edit /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini, and increase the memory_limit to e.g. 2048M. Then restart PHP with "killall lsphp" command
Hi ! I stated that my memory limit in my php.ini was already quite high at 6144, I've tried 256, 512, 1024, 2048, & 4096, no change.
I've found something interesting in my stderr.log tho

Code:
libgomp: Thread creation failed: Resource temporarily unavailable
After some research on this exact line (Found nothing in relation to openlitespeed tho) I've found an environment variable to limit the number of threads this lib can create.

I've put it in my lsphp config as
Code:
OMP_NUM_THREADS=6
And so far so good, haven't had an out of memory error since yesterday 4PM (It's 9AM as I'm writing this. Kinda weird to me as I don't really see how the out of memory error and the number of threads created relate but at least it looks like it's fixed.

Any Idea why this would happen tho ?
 
#5
I know... I got some more OOM errors tho far less, a plugin is malfunctionning on my wordpress instance because of an unexpected update. Maybe it comes from this, I'm currently investigating this issue with their support team. Tho I don't really know why it throws OOM errors while trying to allocate more or less 200MB while I have a 6GB limit and my memory usage never exceeds 2GB on my host system.

Is there something else I've missed that could cap the memory limit to something like 256 megs ?
PHPInfo shows 6GB, Wordpress constants show 6GB aswell so I don't really get it..
 
Top