Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

samtregar (2699)

  (email not shown publicly)

Journal of samtregar (2699)

Monday June 16, 2003
06:06 PM

Long-running CGI + Mozilla 1.2.1 = Inifnity

[ #12887 ]
I spent most of today tracking a very ellusive bug. Basically, another developer reported that when he tried to publish a story through our CMS the CGI entered into an infinite loop which lasted until he killed the server. He described the story he was trying to publish and even sent me a dump. Try as I might, I couldn't get anything but success on my machine.

Finally, in desperation, I took over his machine while he went to lunch. I inserted some debugging code and tailed all the logs. That's when I found it. Here's how it works:

  1. The request comes in to the publish CGI.
  2. The publish process takes a long time (this machine is much slower than mine).
  3. Apache times out the request and issues a "read script header timed out" error in the logs.
  4. The web browser (Mozilla 1.2.1) decides that since it got an empty result it should retry the request. Back to step 1!

The reason I couldn't trigger the problem is that my machine is too fast. I never got the timeout from Apache. Also, it seems that my version of Mozilla (1.3) doesn't retry requests after getting an empty response. At this point I was totally stunned. It never occured to me that the problem could be in the browser!

My solution was to modify the long-running CGI to produce a progress bar as it runs. This ensures that Apache never times out and also keeps the user from getting too bored. I'd planned to do this anyway but it was low on the todo list.

Bug hunting is tiring, but you just can't beat the exhilaration of killing the tough ones!


The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.