develooper Front page | perl.perl5.porters | Postings from February 2004

Re: [perl #26787] read reports wrong eof under high system load

Thread Previous | Thread Next
From:
Michael Bell
Date:
February 19, 2004 01:20
Subject:
Re: [perl #26787] read reports wrong eof under high system load
Message ID:
40346D81.8090905@cms.hu-berlin.de
(Ton Hospel) via RT wrote:
> In article <rt-3.0.8-26787-78336.2.2498005290219@perl.org>,
> 	Michael Bell (via RT) <perlbug-followup@perl.org> writes:
> 
>>If a Linux system runs with a high system load then it can happen
>>that "read" returns a 0 but it is no EOF. The perldocumentation
>>"man perlfunc" includes the statement that a zero only happens at
>>EOF. We tested the same situation with a Solaris system which
>>does not produce this error.
>>
> 
> Personally I'd rather see this reported as a linux bug. Do
> you have code to reproduce this ?

No, I have no small script to do this. We found this problem during 
testing a batch system for a PKI (OpenCA). The problem only happens if 
you have more than 90 percent total system load.

I don't think that it is a Linux bug because this behaviour is compliant 
to the POSIX specs. I think that Perl is not aware of the latest POSIX 
specs (blocking read can return zero characters and this is correct). 
BTW I think that the real bug is in the POSIX specs because there is not 
explicitly written that a zero always signals EOF if it is a blocking 
read on a regular file. I like the Solaris behaviour much more than the 
Linux one's.

My problem is that this beahviour means that there is no real blocking I 
/O. The only chance to find a EOF after a POSIX read is now

pos = lseek (fildes, 0, SEEK_CUR);
fstat (fildes, buf);
if (pos >= buf.st_size) ...

This only works for regular files. Again I think that a returned zero 
should signal EOF but the POSIX specs doesn't define this and the 
question is now is this wanted by the authors or not?

Michael
-- 
-------------------------------------------------------------------
Michael Bell                   Email: michael.bell@cms.hu-berlin.de
ZE Computer- und Medienservice            Tel.: +49 (0)30-2093 2482
(Computing Centre)                        Fax:  +49 (0)30-2093 2704
Humboldt-University of Berlin
Unter den Linden 6
10099 Berlin                   Email (private): michael.bell@web.de
Germany                                       http://www.openca.org


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About