分析超时的Perl CGI脚本 [英] Profiling a Perl CGI script that times-out
问题描述
我有一个Perl CGI应用程序,有时会超时,导致它被Apache杀死,并且504 Gateway Time-out
错误被发送到浏览器.我正在尝试使用NYTProf对此应用程序进行配置文件,但是我无法读取配置文件数据:
I have a Perl CGI application that sometimes times out, causing it to be killed by Apache and 504 Gateway Time-out
error to be sent to browser. I am trying to profile this application using NYTProf, however I cannot read profile data:
$ nytprofhtml -f www/cgi-local/nytprof.out
Reading www/cgi-local/nytprof.out
Profile data incomplete, inflate error -5 ((null)) at end of input file, perhaps the process didn't exit cleanly or the file has been truncated (refer to TROUBLESHOOTING in the documentation)
我正在使用sigexit=1
NYTProf选项.这是重现问题的最小CGI脚本:
I am using sigexit=1
NYTProf option. Here's minimal CGI script that reproduces problem:
#!/usr/bin/perl -d:NYTProf
sleep 1 while 1;
推荐答案
设置sigexit=1
告诉NYTProf捕获以下信号:
Setting sigexit=1
tells NYTProf to catch the following signals:
INT HUP PIPE BUS SEGV
但是,当您的CGI脚本超时时,Apache发送SIGTERM
.您需要赶上SIGTERM
:
However, when your CGI script times out, Apache sends SIGTERM
. You need to catch SIGTERM
:
sigexit=term
要捕获除默认信号以外的SIGTERM
,请使用:
To catch SIGTERM
in addition to the default signals, use:
sigexit=int,hup,pipe,bus,segv,term
这篇关于分析超时的Perl CGI脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!