How to debug 503 Service Unavailable error

#1
Hello,

We are using dompdf library which is a php library that converts html to pdf. And for some html documents we are trying to convert, server outputs 503 error (the server is cpanel litespeed).

The error is consistent and always happens for a given document. However if I start taking away some stuff from the document, it starts working at some point. I also tried taking away different pieces of the document and it seems that the error is not specific to some piece, but rather to the total size of the document.

That led me to believe that the server is hitting some memory limit. However when I created a test script that overloads the memory and ran it on the same server, the behavior was normal: it was gradually using up the memory and then died with php's memory error when it did hit the right limit. Then I decided to test against script run-time in case it's an infinite loop. The script in question fails with 503 error after 35 seconds of execution. A test script that just waits for 60 seconds, doesn't fail at all.

So I am a little lost and would appreciate some help debugging this. I tried searching through forum and checking multiple log files but didn't find anything useful. Could you let me know how I should approach the problem, i.e. how can I get from the server anything more descriptive than 503. We tried increasing different configs in litespeed admin area but that didn't help too.
 

webizen

Well-Known Member
#2
what's your PHP version? memory_limit (shown in phpinfo page), memory limit (soft/hard) in lsphp5?

paste snippet of the script in question to help us duplicate the issue. also the message around 503 error in the error_log.
 
#3
The PHP version is 5.2.8
memory_limit = 200M
memory soft limit = 629145600
memory hard limit = 929145600

Pasting the snippet of code is problematic. :) It's a huge 3rd party script with many classes and complex logic and I am not sure where exactly it is failing.

After setting error reporting level to the highest value, I've managed to find 503 in the error log, please see the attached file.
 

Attachments

webizen

Well-Known Member
#4
2012-04-06 15:21:56.737 [INFO] [CONNECTION_IP:52234-0#APVH_DOMAIN.GOES.HERE:lsapi] connection to [/tmp/lshttpd/APVH_alohawork.DOMAIN.GOES.HERE_Suphp.sock] on request #0, confirmed, 1, associated process: 5644, running: 0, error: Connection reset by peer!
2012-04-06 15:21:56.738 [DEBUG] [CONNECTION_IP:52234-0#APVH_DOMAIN.GOES.HERE:lsapi] [ExtConn] close()
2012-04-06 15:21:56.738 [DEBUG] [uds://tmp/lshttpd/APVH_alohawork.DOMAIN.GOES.HERE_Suphp.sock] No Request has been processed successfully through this connection, the maximum connections allowed will be reduced!
2012-04-06 15:21:56.738 [DEBUG] [CONNECTION_IP:52234-0#APVH_DOMAIN.GOES.HERE:lsapi] HttpExtConnector::tryRecover()...
2012-04-06 15:21:56.738 [NOTICE] [CONNECTION_IP:52234-0#APVH_DOMAIN.GOES.HERE:lsapi] Max retries has been reached, 503!
2012-04-06 15:21:56.738 [DEBUG] [CONNECTION_IP:52234-0#APVH_DOMAIN.GOES.HERE:lsapi] HttpIOLink::continueWrite()...
2012-04-06 15:21:56.738 [DEBUG] [CONNECTION_IP:52234-0#APVH_DOMAIN.GOES.HERE:lsapi] write resumed!
503 error is due to PHP failed/crashed. Run the php script in question manually and see any errors. Also check stderr.log.
 
Top