Timeout Problem

#1
I'm having a problem with LSWS timing out on my server. It seems that the problem is triggered when a user executes a PHP script that exceeds the LSWS timeout limit. After the first timeout, subsequent requests to other PHP scripts time out even if they are very simple scripts.

I'm guessing that what's happening is that the first script is using up all the available PHP connections and/or processes, and when the timeout occurs, it's not releasing those connections, which means that subsequent PHP requests would be waiting indefinitely for a connection to become available.

There's probably some setting that will fix this, but I'm not sure what to do. I just tried setting my "Max Idle Time" to 30. Previously this was not set, but I don't know if this will make any difference. I also tried setting "Initial Request Timeout" to 60. This was also previously not set.

I'm using LSAPI with:

Instances = 1
PHP_LSAPI_CHILDREN=100

Would it possibly be better to get rid of the PHP_LSAPI_CHILDREN setting, and set Instances = 100?

I know I'm just shooting in the dark and would appreciate some suggestions...
 

mistwang

LiteSpeed Staff
#2
You need to increase the "Initial request Timeout" to at least the time that the slowest script takes. "Connection Timeout" should be longer than the "Initial request timeout". And the slow script should be made faster if possible. :)

Would it possibly be better to get rid of the PHP_LSAPI_CHILDREN setting, and set Instances = 100?
yes, it probably do better when instances = 100 in your case, as php processes is directly managed by lshttpd, and whenever a request timed out, the PHP process handling the request will be terminated. Only drawback with this way, PHP processes can not share their opcode cache with each other, not a big deal in most cases.
 
#3
Sorry for resurrecting this old thread, but I'm having a somewhat similar issue. I have this php script that uses curl to open several http pages, so it takes a long time to run... sometimes it may take 2 hours to complete.

It was designed to be a background task, so no screen output, and there lies the problem. If I modify it so there is output echoed every few seconds on the browser, then the script run flawlessly, even if it takes two hours. However if I disable the screen output, the script will timeout after exactly 5 minutes (I checked by writing the output to a file).

I searched the forums and came across this topic, where it's said to increase the Initial Request Timeout, however mine is set to 60 seconds and the script timeouts after 300 seconds, so I don't think the problem will be solved by increasing this setting.

Any ideas where should I change any settings? Can I set a timeout of 0 for this particular script? I'm running v3.3.22 and PHP 5.2.6.

Thanks
 
Top