Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Greetings!

I'm trying to debug some legacy CGI code that is not working right with some web browsers, notably Firefox. The strategy this script uses is pretty much the same one that merlyn illustrates with a simple script in one of his Linux Magazine columns:

http://www.stonehenge.com/merlyn/LinuxMag/col39.html

This script is supposed to execute a long-running command and display updates along the way. It does this by forking the original process so that the child continues on to feed data to a cache, while the parent essentially instructs the browser to check back periodically for updates.

I've installed merlyn's script locally, and it works fine when I access it with Safari, but it does not behave properly when I use Firefox: instead of displaying the updates, it only displays the final output.

At first I thought that the problem had to do with the <meta http-equiv="refresh"...> directive, but after I re-implemented the refresh using JavaScript and got exactly the same behavior as before, both from Safari and from Firefox, now I think that the problem may have to do with the fork.

The reason behind this hunch is that, if I watch the Apache access logs while I attempt to run the script, I see only two lines corresponding to this interaction: the initial POST and the very last GET; all the intervening GETs are missing (and there's nothing in the error log). More importantly, the initial POST does not appear in the logs when it is made, but several seconds later, simultaneously with the appearance of the final GET line, right around the time when the browser finally displays the results. This suggested to me that maybe the initial POST was not being deemed complete until the child from the initial fork was done.

Even if this is the case, it's not entirely clear to me why the behavior is different with Safari. (When the interaction is with Safari, all the intermediate GETs show up in the logs, and they appear at regular intervals throughout the interaction.)

If anyone has any ideas about how to troubleshoot this further please let me know.

Many thanks in advance!

the lowliest monk


In reply to Problem w/ forking CGI script by tlm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-03-28 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found