You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Graham Dumpleton <gr...@gmail.com> on 2007/04/10 07:37:14 UTC

mod_cgid and timeout on writing data to daemon from child.

In the mod_cgid handler it writes its header block to the daemon
process and then cycles between reading request content and writing it
to the daemon until the data from HTTP client has been exhausted. Only
then does it try and read data back from the daemon.

Where it is writing request content to the daemon it uses:

            /* Keep writing data to the child until done or too much time
             * elapses with no progress or an error occurs.
             */
            rv = apr_file_write_full(tempsock, data, len, NULL);

            if (rv != APR_SUCCESS) {
                /* silly script stopped reading, soak up remaining message */
                child_stopped_reading = 1;
            }

In the comment it says 'until done or too much time elapses with no
progress'. That it mentions time suggests it perhaps uses some timeout
mechanism, but I can't find any evidence of this. Specifically, there
are no calls to apr_file_pipe_timeout_set() to set a timeout value on
tempsock that I can find.

Thus, it would appear that if the CGI script executed by the daemon
stops reading in request content for some reason before it has all
been read and there is insufficient buffer space within socket to hold
any remaining request content that the call to apr_file_write_full()
will just hang indefinitely.

Am I interpreting this correctly or is there some over timeout
mechanism coming into play somewhere else. How is it determining when
'too much time elapses with no progress'?

Graham