How to debug 503 Service Unavailable error

Discussion in 'General' started by eugene_b, Apr 5, 2012.

  1. eugene_b

    eugene_b New Member


    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.
  2. webizen

    webizen Well-Known Member

    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. eugene_b

    eugene_b New Member

    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.

    Attached Files:

    • log.txt
      File size:
      13.5 KB
  4. webizen

    webizen Well-Known Member

    503 error is due to PHP failed/crashed. Run the php script in question manually and see any errors. Also check stderr.log.

Share This Page