fork() failed, please increase process limit

#1
I get lots of fork() failed, please increase process limit: Resource temporarily unavailable
and libgomp: Thread creation failed: Resource temporarily unavailable
and sh: 1: Cannot fork

I have raised the open files limit to root, nobody,* to 512000 and also the LSAPI external soft and hard limit to 512000.
After a while 2-3 days my server hangs completely and no process can be created.

Ubuntul 16 Xenial , Openlitespeed 1.4.14
 

Pong

Administrator
Staff member
#2
"fork() failed, please increase process limit: Resource temporarily unavailable" is a sign that the limits have been reached. Usually increasing lsphp external apps soft and hard limit should work.

How many PHP external apps do you have? Which one is in use?

Any error message again after you raised the soft and hard limit to the right lsphp external apps?

When you said " server hangs", were there too many lsphp process? or something else, any thing in error log?
 
#3
THere are 4 PHP external apps and I use only one with PHP 5.6.15 compiled from the menu.
The errors are the same
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
2016-02-10 23:44:03.601 [ERROR] Failed to restart the server!
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable
fork() failed, please increase process limit: Resource temporarily unavailable

No,there arent many lsphp processes, max 100 simultaneously. I have a CPU 5930k overcloacked to 4.5GHZ with 48 GB ddr4 and an PCI-e Intel ssd 400GB as boot . I barely touch a 20% CPU usage.

On ulimit -a nobody I recieve
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 191863
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 512000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 191863
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

The same is for root and other users.
When I mean hangs I mean that no other application like mysql,postfix or other can fork processes .

Also I have set
PHP_LSAPI_MAX_REQUESTS=10000
PHP_LSAPI_CHILDREN=10000
But without them I recieve the same errors.


Other logs from kernel
kernel: [25997.241569] lsphp-5.6.15[185103]: segfault at 0 ip 00007fdb1258062b sp 00007fdafa8c8f80 error 4 in libresolv-2.21.so[7fdb12575000+17000]
 
Last edited:

mistwang

LiteSpeed Staff
#4
You should run "ulimit -a" from a php script, to check the real value of "max user processes" applied. It is too low. Need to raise process limit for lsphp external app.
 
#7
from a php script ulimit -u doesnt show anything and from su - nobody user shows ulimit: Illegal option -u

I have changed shell for user nobody from /bin/sh to /bin/bash and it doesnt show me the ulimit -u from php script.On the ssh shell on bash, it shows me 512000.
 
Last edited:
Top