in reply to Methods to debug CGI issues

Looks to me like chb is exactly right. And for this problem, strace is precisely the right tool, if you know how to read the output. If not, then as usual the granddaddy of all Swiss Army Intercontinental Ballistic Missiles would be the right tool (you may know it as "Google").

I am not Google, merely someone who can interpret strace output, so I'll break it down for you.

That something else is probably the web server, since it's generally the only thing that knows enough and cares enough about CGI processes to murder them. The next step is to look into its error log to see if it reported why it terminated your script -- but you did that and it didn't, which is kind of mysterious. Personally, I'd next strace the parent httpd of the script (run the script first, then attach to the parent you get in the process table with ps axf). But unless you're familiar with using strace output, that may just be a sure recipe for insanity.

I'll echo ropey's comment and ask why you're running this as a CGI?

As a last comment, try running
  strace perl -le '$v=""; vec($v,0,1)=1; select($v,undef,undef,180)'
in one window and then
  kill pid
in another (where pid is the pid of the perl script). You should see very familiar-looking strace output.

Replies are listed 'Best First'.
RESOLVED: Re^2: Methods to debug CGI issues
by ghettofinger (Monk) on Apr 20, 2005 at 17:59 UTC

    Your strace skills are awesome. You and chb are right on the money.

    I have never written any CGI that can take this long to send output to the browser. It seems that apache will end the script if the amount of time reaches a thresh hold defined as Timeout in httpd.conf.

    I have increased the timeout and everything works great. I also learned about debugging CGI as well. Thanks everyone for your help!

    Thanks again,
    ghettofinger