Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
litespeed_wiki:php:503-errors [2018/08/01 18:40]
Jackson Zhang [Strace the PHP process]
litespeed_wiki:php:503-errors [2018/09/14 16:05]
Michael Alegre [The lsphp process is killed unexpectedly by CSF/LFD]
Line 239: Line 239:
 Check the PHP ''​max_execution_time''​ configuration in a phpinfo() page to see if it is set high enough to handle long running requests. ​ Check the PHP ''​max_execution_time''​ configuration in a phpinfo() page to see if it is set high enough to handle long running requests. ​
  
-====The lsphp process is killed unexpectedly by CSF/LFD ====+==== The lsphp process is killed unexpectedly by CSF/LFD ====
  
-When a php script is executing, if the process is killed by the admin or a process monitoring daemon, it'll result in 503 errors.+When a PHP script is executing, if the process is killed by the admin or a process monitoring daemon, it'll result in 503 errors.
  
 === CSF/LFD Kill === === CSF/LFD Kill ===
Line 255: Line 255:
   PT_USERTIME = "​1800"​   PT_USERTIME = "​1800"​
   ​   ​
-So if an lsphp5 process has run 1800 seconds (30 minutes), it might be caught by csf and killed. In php suExec ​Daemon mode or ProcessGroup mode, it's normal that the parent lsphp5 process keeps running after 30 minutes. When csf/lfd kills an lsphp5 process, it'll leave logs in ''/​var/​log/​lfd.log''​. These logs will look similar to the following:+So if an lsphp5 process has run 1800 seconds (30 minutes), it might be caught by csf and killed. In PHP Daemon mode or ProcessGroup mode, it's normal that the parent lsphp5 process keeps running after 30 minutes. When csf/lfd kills an lsphp5 process, it'll leave logs in ''/​var/​log/​lfd.log''​. These logs will look similar to the following:
  
   Jun 19 16:29:16 evo lfd[18304]: *User Processing* PID:18264 Kill:1 User:xxxxx VM:538(MB) EXE:/​usr/​local/​lsws/​fcgi-bin/​lsphp-5.4.42 CMD:lsphp5   Jun 19 16:29:16 evo lfd[18304]: *User Processing* PID:18264 Kill:1 User:xxxxx VM:538(MB) EXE:/​usr/​local/​lsws/​fcgi-bin/​lsphp-5.4.42 CMD:lsphp5
Line 321: Line 321:
  
 ==== Magento 503 error ==== ==== Magento 503 error ====
-After (re)installation of LiteMage Cache extension in Magento Connect manager, Magento site couldn'​t be accessed and may give 503 errors. ​ Please refer [[litespeed_wiki:​cache:​litemage:​troubleshooting:​connect-cache-session-cleaning-error|this]] for details.+After (re)installation of LiteMage Cache extension in Magento Connect manager ​or enable other modules in Magento 2, Magento site may be placed in maintenancence mode and couldn'​t be accessed and may give 503 errors. ​ Please refer [[litespeed_wiki:​cache:​litemage:​troubleshooting:​connect-cache-session-cleaning-error|this]] for details.
  
  
Line 348: Line 348:
   strace -tt -T -f -p 791228   strace -tt -T -f -p 791228
  
-Sometimes, it may not be easily ​to get pid since the PHP may run very quick. In this case, you can try to strace ​**parent pid**, but the disadvantage of stracing parent pid is you may get too much-unrelated information in strace log and not easily ​to locate the problem pattern.+Sometimes, it may not be easy to get the ''​pid'' ​since the PHP may run very quickly. In this case, you can try to strace ​the //parent pid//, but the disadvantage of stracing ​the parent pid is that you may get too much unrelated information in strace log. That would make it difficult ​to locate the problem pattern.
  
-Alternatively,​ using a script to catch the pid.  It depend ​on which SuEXEC user your PHP will be running and which script will be running ( such as index.php etc).+One solution is to use a script to catch the pid.  It depends ​on which SuEXEC user your PHP will be running and which script will be running ( such as index.php etc).
   ​   ​
   while true; do if mypid=`ps aux | grep $USERNAME | grep lsphp | grep $SCRIPTNAME | grep -v grep | awk '​{print $2; }' | tail -1`; then strace -tt -T -f -p $mypid; fi ; done   while true; do if mypid=`ps aux | grep $USERNAME | grep lsphp | grep $SCRIPTNAME | grep -v grep | awk '​{print $2; }' | tail -1`; then strace -tt -T -f -p $mypid; fi ; done
    
-**Note**: ​**$USERNAME** should be replaced ​by real username; ​**$SCRIPTNAME** should be replaced by the script ​name running, such as index.php or other scripts+**Note**: ​''​$USERNAME'' ​should be replaced ​with a real username; ​''​$SCRIPTNAME'' ​should be replaced by the name of the script that is running, such as ''​index.php'' ​or other scripts.
 ==== Enable Core Dump ==== ==== Enable Core Dump ====
  
  • Admin
  • Last modified: 2020/02/11 14:26
  • by Jackson Zhang