我有一个 Perl CGI 应用程序有时会超时,导致它被 Apache 和 504 Gateway Time-out
杀死。发送到浏览器的错误。我正在尝试使用 NYTProf 配置此应用程序,但是我无法读取配置文件数据:
$ 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 脚本:#!/usr/bin/perl -d:NYTProf
sleep 1 while 1;
最佳答案
设置 sigexit=1
告诉 NYTProf 捕捉以下信号:
INT HUP PIPE BUS SEGV
但是,当您的 CGI 脚本超时时,Apache 会发送
SIGTERM
.你需要 catch SIGTERM
:sigexit=term
catch
SIGTERM
除了默认信号外,还可以使用:sigexit=int,hup,pipe,bus,segv,term
关于perl - 分析超时的 Perl CGI 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20739231/