Child process limits

#1
Hi,
I am trying the Litespeed 15days trail version.
I am including a previous apache config that was running with suexec. Everything seems to work fine, all sites are running on the correct user account.
Now i'm testing the security. I've installed a PHP shell to do some tests:
If I run a simple php script to fork infinite child processes, Litespeed stops responding and I have to reboot.
this is the PHP script:

<?
while (1)
pcntl_fork();
?>

I am running PHP as LSAPI with the following options:
Process Soft Limit 10
Process Hard Limit 10

Are these options disabled in the trial version? Is there a solution for this problem.

regards
Christophe
 

mistwang

LiteSpeed Staff
#2
Which OS are you using?
The pcntl_fork() should fail when process limit has been reached. the code may still looping and waste CPU time, but it should not bring down the whole server. We will check.
 
#3
Hi,
I am using Debian latest version.
I know that this script will cause some CPU load. I am running this on our test server because we have the same problem on our production server on Apache. This is the main raison why we are looking for an alternative.

The problem I see is that the PHP process is spawning a lot of child processes. This is strange because I set the limits to a maximum of 10 in the LS PHP configuration.

The next thing I tried was setting up some ulimits. I set the 'nproc' for all web users to 10. But if I run 'ulimit -a' in my PHP shell, the 'nproc' limit is 4096.

If you need more information, please let me know

Christophe
 

mistwang

LiteSpeed Staff
#4
Yeah, you can verify the limit by run "ulimit" from the PHP process.
Try it from command line first. I think it may related to how it was handled by linux kernel.

Try a strace lshttpd when it spawn a new PHP process, see if ulimit has been called.

Are you using suEXEC?
 
#5
I runned the command 'ulimit -a' in both situations:

in shell:

webserver-test:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) 80000
max nice (-e) 0
file size (blocks, -f) 100000
pending signals (-i) unlimited
max locked memory (kbytes, -l) 80000
max memory size (kbytes, -m) 80000
open files (-n) 100
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) unlimited
max rt priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) 7200
max user processes (-u) 10
virtual memory (kbytes, -v) 80000
file locks (-x) unlimited


in PHP shell:

$ ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 4096
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 6000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) 131072
file locks (-x) unlimited

an strace will be something for tomorow ;)

christophe
 
#6
I am using SuExec btw.
Here is my apache vhost:
<VirtualHost xxx.be:80>
ServerName xxx.be
DocumentRoot /web/xxx/
SuexecUserGroup xxx web
AddType application/x-httpd-php4 php
</VirtualHost>
 
#10
thank you for your fast respond!
Is there also a date planned for the new release?
We are currently testing a 15 day trial version with only 8 days left. If it's possible, I want to test the new release also.

thx
Christophe
 
Top