From owner-freebsd-bugs@FreeBSD.ORG Fri Feb 6 01:40:17 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08DE516A4CE for ; Fri, 6 Feb 2004 01:40:17 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A0F8343D41 for ; Fri, 6 Feb 2004 01:40:15 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i169eFbv039034 for ; Fri, 6 Feb 2004 01:40:15 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i169eF4H039033; Fri, 6 Feb 2004 01:40:15 -0800 (PST) (envelope-from gnats) Date: Fri, 6 Feb 2004 01:40:15 -0800 (PST) Message-Id: <200402060940.i169eF4H039033@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Ian Dowse Subject: Re: kern/62216: perl syswrite not writing the buffer under (heavy) disk load X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Ian Dowse List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Feb 2004 09:40:17 -0000 The following reply was made to PR kern/62216; it has been noted by GNATS. From: Ian Dowse To: freebsd-gnats-submit@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@ciger.be>, Henri Hennebert writes: >Ian Dowse wrote: > > In message <200402011305.i11D5VuL021659@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" > >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 > > > >