http://www.perlmonks.org?node_id=577445

talexb has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to understand why a Perl CGI that's the most used page in my web application appears to sometimes 'go to sleep', tying up an Apache kid or two, when all other web pages run fine.

This is more or less a regular CRUD or BREAD web application running through mod_cgi, not mod_perl, using Apache 1.3, Perl 5.8.0, accessing a Postgresql database. While the database has been suspect before, it doesn't appear to be the root of the problem this time around, since I'm not seeing the fatal error about the number of connections being exceeded, and I don't see any pending SELECT statements.

After all that preamble, here's my question: I'd like to try to run gdb against the 'awake but not running and not a zombie' process to find out where it's at, but I'm not familiar about how to do such a thing. The man page suggests I should be able to use

gdb program 1234
to debug a running process .. in the case of a CGI, I presume that would be something like
gdb '/usr/bin/perl /path/to/cgi-bin/script.cgi' 1234
where 1234 was the PID of the sleepy child. Since the problem has solved itself for now, I can't try it today, but I'd like to know for the future, so I can found out what the heck is going on.

I welcome your suggestions. (No, there's nothing useful in neither the log file nor the Log::Log4perl debug logs .. it just goes to TT2's process method and never comes back.)

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds