httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Wood <>
Subject [users@httpd] SIGPIPE not reaching FastCGI program [2nd query] (was Re: [users@httpd] Apache children not dying)
Date Wed, 04 Feb 2004 01:15:24 GMT
Did everyone miss this, or have I stumped the list??? :)

I have a FastCGI script written in Perl, started from an Apache 2.0.47 server with mod_fastcgi-2.4.2.
 The FCGI script downloads largeish (O(10MB)) files to the client.  The script needs to be
able to detect whether the connection to the browser is closed early (via user cancel or something
else).  The script sets a signal handler for SIGPIPE as recommended, but the signal never
arrives.  With the help of, the problem apparently has been found in Apache 2.0.47's
content-length filter.  It buffers all the FCGI output, discards it upon cancel, and the FCGI
script proceeds to wait for the next request, never getting a SIGPIPE.

This behavior seems to be outside the scope or influence of my FCGI script.  My question is:
how safe is the following hack: Inside mod_fastcgi, scan the filter list associated with the
Apache request_rec struct, and remove the content-length filter.  This would be configurable
behavior for mod_fastcgi.  And the FCGI client would be responsible for setting the Content-length
header field (easy to do because it knows the size of the file being downloaded).  Removing
the filter would use the ap_remove_output_filter call, which is in the a public API.  (AP_DECLARE
in the code).  

Of course, this assumes no other filter will buffer likewise.  How do I find the default filters
(aside from scanning lots of Apache code)?  Can any Apache experts comment on this (risks,
alternatives, etc.)?  Is there some other way to get that SIGPIPE back to the FCGI script?


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message