You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Ben Hitchcock <be...@IHATESPAMuow.edu.au> on 2000/12/13 05:02:15 UTC

os-windows/6969: Executing system commands makes apache hang after a couple of k is written to STDOUT.

>Number:         6969
>Category:       os-windows
>Synopsis:       Executing system commands makes apache hang after a couple of k is written to STDOUT.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Tue Dec 12 20:10:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     beh01@IHATESPAMuow.edu.au
>Release:        1.3.14
>Organization:
apache
>Environment:
Windows NT 4.0 servicepack 6A and also Windows 2000.
>Description:
I have been trying to trace a problem with apache whereby executing a system
command in a perl script will sometimes cause the server to hang, and then
reset the connection to the client partway through the output.  The script in
question runs fine under the Xitami web server, but fails under Apache.

This problem seems to be related to the one described here:
http://bugs.apache.org/index.cgi/full/5671
except that maybe the person writing the error report wasn't aware that the
problem could be encountered WITHOUT a large post to stdin.

This problem is most apparent when the script makes the browser do an 
autorefresh.
>How-To-Repeat:
Here is a trivial piece of code that recreates the problem.  I am using 
ActivePerl 5.005_03 and Apache 1.3.14 under WinNT and Win 2000, browsing with Internet Explorer 5.00.2919.  Note that swapping the order of the two loops makes the output come through uninterrupted.


#! C:\perl\bin\perl

use CGI;			# CGI (forms, html and the like) module
$query = new CGI;

$|=1;				# autoflush the buffer.

$program_name = $query->script_name();

print CGI->header;	# Prints the content-type to the browser so IE doesn't get confused.

print << "EndOfText";
<head>
<Title>
Test script
</title>
   <META HTTP-EQUIV=REFRESH CONTENT=\"1;URL=$program_name\">
</head>
<body>
<H2>
Test script to mess with apache under NT.
</h2>
<br>
<br>
You should be able to see the words 'All is well' below.  Time is now:

EndOfText
$now_string = localtime(time);
print $now_string;

############# Swap the two loops below to make apache behave properly ###########

##### Loop 1: #####
$numLines = 0;
while($numLines < 100) {
   print "<!-- This is some text that should be ignored by your browser. -->\n";
   $numLines ++;
}

##### Loop 2: #####
$numLines = 0;
while($numLines < 10) {
   $output = `echo Simulating some system commands....`;
   $numLines ++;
}



print "<br>\n";
print "All is well.";

exit;


>Fix:
I fixed the problem by doing all the system commands before writing the large amounts of data to the browser, but this seems to be a bit of a hack.  
Perhaps the buffer sizes should be increased in the next Win32 release of apache?
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]
 
 


RE: os-windows/6969: Executing system commands makes apache hang after a couple of k is written to STDOUT.

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
I -believe- this is related to the fact that 1.3.14 did not have it's own
console to spawn CGI's from, and there are some pipeing issues involved.

This should be solved, if you can go to dev.apache.org and follow the
instructions for grabbing the current source tarball or grab the current
sources with the anonomous CVS facility (which is nicer, since cr/lf
issues are all resolved by cvs itself), and build, you should find no
remaining issue.

If you aren't in a position to build apache yourself, please wait for the
immenent release of 1.3.15.  Thanks 


> -----Original Message-----
> From: Ben Hitchcock [mailto:beh01@IHATESPAMuow.edu.au]
> Sent: Tuesday, December 12, 2000 10:02 PM
> To: submit@bugz.apache.org
> Subject: os-windows/6969: Executing system commands makes apache hang
> after a couple of k is written to STDOUT.
> 
> 
> 
> >Number:         6969
> >Category:       os-windows
> >Synopsis:       Executing system commands makes apache hang 
> after a couple of k is written to STDOUT.
> >Confidential:   no
> >Severity:       serious
> >Priority:       medium
> >Responsible:    apache
> >State:          open
> >Quarter:        
> >Keywords:       
> >Date-Required:
> >Class:          sw-bug
> >Submitter-Id:   apache
> >Arrival-Date:   Tue Dec 12 20:10:01 PST 2000
> >Closed-Date:
> >Last-Modified:
> >Originator:     beh01@IHATESPAMuow.edu.au
> >Release:        1.3.14
> >Organization:
> apache
> >Environment:
> Windows NT 4.0 servicepack 6A and also Windows 2000.
> >Description:
> I have been trying to trace a problem with apache whereby 
> executing a system
> command in a perl script will sometimes cause the server to 
> hang, and then
> reset the connection to the client partway through the 
> output.  The script in
> question runs fine under the Xitami web server, but fails 
> under Apache.
> 
> This problem seems to be related to the one described here:
> http://bugs.apache.org/index.cgi/full/5671
> except that maybe the person writing the error report wasn't 
> aware that the
> problem could be encountered WITHOUT a large post to stdin.
> 
> This problem is most apparent when the script makes the browser do an 
> autorefresh.
> >How-To-Repeat:
> Here is a trivial piece of code that recreates the problem.  
> I am using 
> ActivePerl 5.005_03 and Apache 1.3.14 under WinNT and Win 
> 2000, browsing with Internet Explorer 5.00.2919.  Note that 
> swapping the order of the two loops makes the output come 
> through uninterrupted.
> 
> 
> #! C:\perl\bin\perl
> 
> use CGI;			# CGI (forms, html and the like) module
> $query = new CGI;
> 
> $|=1;				# autoflush the buffer.
> 
> $program_name = $query->script_name();
> 
> print CGI->header;	# Prints the content-type to the 
> browser so IE doesn't get confused.
> 
> print << "EndOfText";
> <head>
> <Title>
> Test script
> </title>
>    <META HTTP-EQUIV=REFRESH CONTENT=\"1;URL=$program_name\">
> </head>
> <body>
> <H2>
> Test script to mess with apache under NT.
> </h2>
> <br>
> <br>
> You should be able to see the words 'All is well' below.  Time is now:
> 
> EndOfText
> $now_string = localtime(time);
> print $now_string;
> 
> ############# Swap the two loops below to make apache behave 
> properly ###########
> 
> ##### Loop 1: #####
> $numLines = 0;
> while($numLines < 100) {
>    print "<!-- This is some text that should be ignored by 
> your browser. -->\n";
>    $numLines ++;
> }
> 
> ##### Loop 2: #####
> $numLines = 0;
> while($numLines < 10) {
>    $output = `echo Simulating some system commands....`;
>    $numLines ++;
> }
> 
> 
> 
> print "<br>\n";
> print "All is well.";
> 
> exit;
> 
> 
> >Fix:
> I fixed the problem by doing all the system commands before 
> writing the large amounts of data to the browser, but this 
> seems to be a bit of a hack.  
> Perhaps the buffer sizes should be increased in the next 
> Win32 release of apache?
> >Release-Note:
> >Audit-Trail:
> >Unformatted:
>  [In order for any reply to be added to the PR database, you need]
>  [to include <ap...@Apache.Org> in the Cc line and make sure the]
>  [subject line starts with the report component and number, with ]
>  [or without any 'Re:' prefixes (such as "general/1098:" or      ]
>  ["Re: general/1098:").  If the subject doesn't match this       ]
>  [pattern, your message will be misfiled and ignored.  The       ]
>  ["apbugs" address is not added to the Cc line of messages from  ]
>  [the database automatically because of the potential for mail   ]
>  [loops.  If you do not include this Cc, your reply may be ig-   ]
>  [nored unless you are responding to an explicit request from a  ]
>  [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]
>  
>  
>