Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 18677
Status: rejected
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: paul [...] blues.co.nz
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: CGI.pm: Server closed socket during multipart read (client aborted?).
I am trying to use a cgi file-upload script. My server is Win XP Pro/Apache2/Perl 5.8 The script dies on this line of code: my $cg = new CGI(); It seems to be something to do with this in CGI.pm: # An apparent bug in the Apache server causes the read() # to return zero bytes repeatedly without blocking if the # remote user aborts during a file transfer. I don't know how # they manage this, but the workaround is to abort if we get # more than SPIN_LOOP_MAX consecutive zero reads. if ($bytesRead <= 0) { die "CGI.pm: Server closed socket during multipart read (client aborted?).\n" if ($self->{ZERO_LOOP_COUNTER}++ >= $SPIN_LOOP_MAX); } else { $self->{ZERO_LOOP_COUNTER}=0; } I tried commenting out the die/if>SPIN_LOOP_MAX check, but then the upload script just hangs there doing nothing, presumably stuck in a loop. One thing I can say is that this is nothing to do with the remote user (me) aborting during the file transfer. I get same error when uploading from Firefox and MSIE. It seems there is a more fundamental problem here?
From: paul [...] blues.co.nz
a quick update: I seem to avoid this problem if the file I upload is very small, approx 1kb In CGI.pm I have: # Set this to a positive value to limit the size of a POSTing # to a certain number of bytes: $POST_MAX = -1; Setting it to a large value doesn't help. Hope this narrows things down for you.
You haven't indicated what version of CGI.pm this problem affects. Other users are not reporting this problem on any version of Apache.
It would help to post the exact script you are using.
Please upload the script that is causing the problem for you and provide some sample data.
On Thu Apr 13 16:56:37 2006, LDS wrote: Show quoted text
> Please upload the script that is causing the problem for you and > provide some sample data.
I had this problem with CGI.pm v3.15, I tried upgrading to v3.17 but no difference. I have attached the cgi script I'm trying to get working, it comes from this site: http://tomas.epineer.se/archives/3
Download upload.cgi
application/octet-stream 6k

Message body not shown because it is not plain text.

as far as sample data, when I run the script I get the error message from the quoted line of code in CGI.pm CGI.pm: Server closed socket during multipart read (client aborted?).
On Sun Apr 23 18:40:20 2006, guest wrote: Show quoted text
> as far as sample data, when I run the script I get the error message > from the quoted line of code in CGI.pm > > CGI.pm: Server closed socket during multipart read (client > aborted?).
I've the same problem using a BBS named wakaba, i'll post here the wakaba.pl (the script what handle the upload). I'm using apache2 and CGI in version 3.20.

Message body is not shown because it is too large.

On Tue Jun 13 19:27:18 2006, guest wrote: Show quoted text
> On Sun Apr 23 18:40:20 2006, guest wrote:
> > as far as sample data, when I run the script I get the error message > > from the quoted line of code in CGI.pm > > > > CGI.pm: Server closed socket during multipart read (client > > aborted?).
> > > I've the same problem using a BBS named wakaba, i'll post here the > wakaba.pl (the script what handle the upload). > > I'm using apache2 and CGI in version 3.20.
A solution for my problem was found... see here for reference: http://tomas.epineer.se/archives/3 Basically had to add a 'binmode' call in the Perl script when opening the file for writing, eg: open(TMP,”>”,”$post_data_file”) or &bye_bye (”Can’t open temp file”); binmode(TMP); I presume this is specific to the Windows operating system
On Mie. Jun. 14 04:56:45 2006, guest wrote: Show quoted text
> On Tue Jun 13 19:27:18 2006, guest wrote:
> > On Sun Apr 23 18:40:20 2006, guest wrote:
> > > as far as sample data, when I run the script I get the error message > > > from the quoted line of code in CGI.pm > > > > > > CGI.pm: Server closed socket during multipart read (client > > > aborted?).
> > > > > > I've the same problem using a BBS named wakaba, i'll post here the > > wakaba.pl (the script what handle the upload). > > > > I'm using apache2 and CGI in version 3.20.
> > A solution for my problem was found... see here for reference: > http://tomas.epineer.se/archives/3 > > Basically had to add a 'binmode' call in the Perl script when opening > the file for writing, eg: > > open(TMP,”>”,”$post_data_file”) or &bye_bye (”Can’t open temp file”); > binmode(TMP); > > I presume this is specific to the Windows operating system >
No, i'm runing on Fedora Core 2, not windows.
From: mad93
On Wed Jun 14 04:56:45 2006, guest wrote: Show quoted text
> On Tue Jun 13 19:27:18 2006, guest wrote:
> > On Sun Apr 23 18:40:20 2006, guest wrote:
> > > as far as sample data, when I run the script I get the error message > > > from the quoted line of code in CGI.pm > > > > > > CGI.pm: Server closed socket during multipart read (client > > > aborted?).
> > > > > > I've the same problem using a BBS named wakaba, i'll post here the > > wakaba.pl (the script what handle the upload). > > > > I'm using apache2 and CGI in version 3.20.
> > A solution for my problem was found... see here for reference: > http://tomas.epineer.se/archives/3 > > Basically had to add a 'binmode' call in the Perl script when opening > the file for writing, eg: > > open(TMP,”>”,”$post_data_file”) or &bye_bye (”Can’t open temp file”); > binmode(TMP); > > I presume this is specific to the Windows operating system >
In the wakaba script the uploads are handled the way you say: # copy file open (OUTFILE,">>$filename") or make_error(S_NOTWRITE); binmode OUTFILE; while (read($file,$buffer,1024)) # should the buffer be larger? { print OUTFILE $buffer; $md5ctx->add($buffer) if($md5ctx); } close $file; close OUTFILE; But doesn't work :S
On Wed Apr 12 08:59:28 2006, guest wrote: Show quoted text
> I am trying to use a cgi file-upload script. My <b style="color:
black;background-color:#ffff66">server</b> is Win XP Show quoted text
> Pro/Apache2/Perl 5.8 > > The script dies on this line of code: > my $cg = new CGI(); > > It seems to be something to do with this in CGI.pm: > > # An apparent bug in the Apache <b style="color:black;background-
color:#ffff66">server</b> causes the <b style="color:white;background- color:#880000">read</b>() Show quoted text
> # to return zero bytes repeatedly without blocking if the > # remote user aborts <b style="color:black;background-color:
#ff9999">during</b> a file transfer. I don't know how Show quoted text
> # they manage this, but the workaround is to abort if we get > # more than SPIN_LOOP_MAX consecutive zero reads. > if ($bytesRead <= 0) { > die "CGI.pm: <b style="color:black;background-color:
#ffff66">Server</b> <b style="color:black;background-color: #a0ffff">closed</b> <b style="color:black;background-color: #99ff99">socket</b> <b style="color:black;background-color: #ff9999">during</b> <b style="color:black;background-color: #ff66ff">multipart</b> <b style="color:white;background-color: #880000">read</b> (<b style="color:white;background-color: #00aa00">client </b>> <b style="color:white;background-color:#886800">aborted</b>?).\n" Show quoted text
> if ($self->{ZERO_LOOP_COUNTER}++ >= $SPIN_LOOP_MAX); > } else { > $self->{ZERO_LOOP_COUNTER}=0; > } > > > I tried commenting out the die/if>SPIN_LOOP_MAX check, but then the > upload script just hangs there doing nothing, presumably stuck in a
loop. Show quoted text
> > One thing I can say is that this is nothing to do with the remote
user Show quoted text
> (me) aborting <b style="color:black;background-color:
#ff9999">during</b> the file transfer. I get same error when uploading Show quoted text
> from Firefox and MSIE. It seems there is a more fundamental problem
here?
I'm marking this bug as "rejected" due to lack of follow-up since 2006. If a bug like this still seems to persistent, please reply this message to re-open the ticket. Mark