You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2002/04/23 03:02:42 UTC

DO NOT REPLY [Bug 8388] New: - Long running CGI script cannot terminated by browser

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8388>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8388

Long running CGI script cannot terminated by browser

           Summary: Long running CGI script cannot terminated by browser
           Product: Apache httpd-2.0
           Version: 2.0.35
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: mod_cgi
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: qwan@seatab.com


When a CGI script runs for a long time and the user clicks the "Stop" or "Back" 
button in the browser before it ends, the server fails to terminate the CGI 
process on the server, even if the CGI script is frequently writing back 
lines.  Here's a sample partial CGI script:

$| = 1;
print "<pre>\n":
foreach (1 .. 50)
{
    print "line $_\n";
    sleep (1);
}

This script continues to run even if the user has clicked "Stop" in the browser 
5 seconds into the process.

I remember fixing this problem in Apache 1.3 by closing the right process 
handle.  But since 1.3 was not able to have unbuffered I/O to write back to the 
HTTP server process immediately, the fix was not useful for 1.3 anyway.  Now 
that 2.0 seems to be able to have unbuffered IO for CGI output (finally!), 
fixing this bug would be extremely helpful, especially in defeating MS.  This 
is a killer shortcoming of IIS where a run-away CGI script can never be 
terminated except the pre-defined "cut-off" time for all scripts.