Return-Path: Delivered-To: apache-bugdb-archive@hyperreal.org Received: (qmail 21059 invoked by uid 6000); 24 Aug 1998 04:50:04 -0000 Received: (qmail 20993 invoked by uid 2001); 24 Aug 1998 04:50:00 -0000 Received: (qmail 20093 invoked by uid 2012); 24 Aug 1998 04:47:06 -0000 Message-Id: <19980824044706.20092.qmail@hyperreal.org> Date: 24 Aug 1998 04:47:06 -0000 From: Gerd Knops Reply-To: gerti@BITart.com To: apbugs@hyperreal.org X-Send-Pr-Version: 3.2 Subject: mod_cgi/2894: cgi triggers premature EOF to be sent to client Sender: apache-bugdb-owner@apache.org Precedence: bulk >Number: 2894 >Category: mod_cgi >Synopsis: cgi triggers premature EOF to be sent to client >Confidential: no >Severity: serious >Priority: medium >Responsible: apache >State: open >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Sun Aug 23 21:50:00 PDT 1998 >Last-Modified: >Originator: gerti@BITart.com >Organization: apache >Release: 1.3.1 >Environment: NEXTSTEP 3.3 >Description: Hi Guys, Sorry, this is going to be vague, but maybe it rings a bell somewhere. A cgi script working perfectly fine with 1.2.x suddenly started failing. The script sends a number of fixed size files from a floppy to a java applet. The Java applet receives a premature EOF, which in turn causes apache to send a SIGTERM to the CGI. Here is the code in the CGI that sends the files: foreach my $file (@files) { my $mtime=(stat("$floppy/$file"))[9]; print "$file\t$mtime\r\n"; open(IN,"$floppy/$file"); my $buf=""; unless(sysread(IN,$buf,4608)==4608) { die("$0: Error reading 4608 bytes from $floppy/$file"); } close(IN) || die("$0: Close failed for $floppy/$file"); print $buf; } The CGI doesn't produce any error messages. To make things more bizar, calling the CGI a number of times makes it fail later and later in the process, until it finally works. Remount the floppy, and the problems start over. I thought it might have to do with me sending binary data, so I replaced the "print $buf;" with "print '-' x 4608;", but the behavior was the same. I guess it has to do woth apache now sending the output from the CGI unbuffered, but I am at a total loss to even figure out what or where it goes wrong. The only thing changed since the script used to work was apache. Setting $! to 0 or 1 in perl doesn't make any difference. I'd be very thankful for any pointers. Gerd >How-To-Repeat: >Fix: >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, ] [you need to include in the Cc line ] [and leave the subject line UNCHANGED. This is not done] [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! ]