kern/62216: perl syswrite not writing the buffer under (heavy) disk load

Ian Dowse iedowse at maths.tcd.ie
Fri Feb 6 01:40:17 PST 2004


The following reply was made to PR kern/62216; it has been noted by GNATS.

From: Ian Dowse <iedowse at maths.tcd.ie>
To: freebsd-gnats-submit at freebsd.org
Cc:  
Subject: Re: kern/62216: perl syswrite not writing the buffer under (heavy) disk load 
Date: Fri, 06 Feb 2004 09:37:35 +0000

 Adding to the audit trail - it seems that EAGAIN/EWOULDBLOCK is
 being returned by a normal blocking write:
 
 In message <40234A7B.3090103 at ciger.be>, Henri Hennebert writes:
 >Ian Dowse wrote:
 > > In message <200402011305.i11D5VuL021659 at norquay.cocoon.bel>, Henri 
 >Hennebert wr
 > > ites:
 > >
 > >>   while (my $len = sysread(SRC, $buf, $sz)) {
 > >>       print STDERR "$len=";        //DEBUG - print length read
 > >>       my $len_w = syswrite(CMD, $buf, $len);
 > >>       print STDERR "$len_w ";      //DEBUG - print length written
 > >>   }
 > >
 > >
 > > syswrite returns the number of bytes written, or undef if the write
 > > failed, so a loop like the above needs to check the return value
 > 
 >I agree but how does it work so long for so many ???
 > 
 > > and handle it appropriately. What happens if you change it to
 > > something like this?
 > >
 > >       while (my $len = sysread(SRC, $buf, $sz)) {
 > >               my $wlen = 0;
 > >               while ($wlen < $len) {
 > >                       my $len_w = syswrite(CMD, $buf, $len - $wlen, 
 >$wlen);
 > >                       die "$cmd: $!\n" unless defined($len_w);
 > >                       $wlen += $len_w;
 > >               }
 > >       }
 > >
 > > It's the "die .. $!" that will help to debug the problem, since it
 > > will print out the error message associated with the write failure.
 > >
 >Here is the result of make :
 >===>  Configuring for p5-Mail-SpamAssassin-2.61_1
 >Checking if your kit is complete...
 Warning: the following files are missing in your kit:
 >        rules/local.cf
 >Please inform the author.
 >Writing Makefile for Mail::SpamAssassin
 >Makefile written by ExtUtils::MakeMaker 6.17
 >===>  Building for p5-Mail-SpamAssassin-2.61_1
 >/usr/local/bin/perl5.8.2 build/preprocessor -Mconditional -Mbytes
 >-DPERL_VERSION="5.8.2" -Mvars -DVERSION="2.61" -DPREFIX="/usr/local"
 ><lib/Mail/SpamAssassin/AutoWhitelist.pm 
 > >blib/lib/Mail/SpamAssassin/AutoWhitelist.pm
 >/usr/local/bin/perl5.8.2 build/preprocessor -Mconditional -Mbytes
 >-DPERL_VERSION="5.8.2" -Mvars -DVERSION="2.61" -DPREFIX="/usr/local": 
 >Resource
 >temporarily unavailable
 >*** Error code 35
 > 
 >Stop in
 >/var/spool/ports/mail/p5-Mail-SpamAssassin/work/Mail-SpamAssassin-2.61.
 >*** Error code 1
 > 
 >Stop in /var/spool/ports/mail/p5-Mail-SpamAssassin.
 > 
 > 
 >Henri
 > 
 >
 >
 >


More information about the freebsd-bugs mailing list