Bug 58824 - write(2) can block despite fd being non-blocking
write(2) can block despite fd being non-blocking
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-01-25 05:13 EST by peter.benie
Modified: 2008-08-01 12:22 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-09-30 11:39:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description peter.benie 2002-01-25 05:13:42 EST
Description of problem:
If there is a blocking write to a tty or pipe that is pending completion, then
*all* writes to the same tty or pipe will block. This is true even for fds that
are supposed to be non-blocking!

How reproducible:
For pipes and ttys  on 2.2 kernels: Always
For ttys on 2.4 and 2.5 kernels: Always

Steps to Reproduce:
Run the test programs from the above URL

Additional info:

The above URL contains a patch to fix this issue for 2.2 and 2.4 kernels. The
2.4 patch applies cleanly and works on 2.5.
Comment 1 Arjan van de Ven 2002-01-25 05:18:36 EST
Patch looks fine except that the return value might need to be
-EWOULDBLOCK; I'll go hunt the appropriate standards...
Comment 2 peter.benie 2002-01-25 06:03:29 EST
SUSv2 only lists EAGAIN for write();  network operations (send(2) etc)  may
return either EAGAIN or EWOULDBLOCK. 

SUSv2 also states that EWOULDBLOCK may be the same value as EAGAIN, and this is
the case under Linux for all architectures except PA-RISC, where you will find
the following comment in errno.h:
#define EWOULDBLOCK     246     /* Operation would block (Linux returns EAGAIN)
Comment 3 Alan Cox 2002-01-25 08:42:24 EST
The tty one is fixed in 2.4.18-ac and  pushed on to Marcelo
Comment 4 Bugzilla owner 2004-09-30 11:39:21 EDT
Thanks for the bug report. However, Red Hat no longer maintains this version of
the product. Please upgrade to the latest version and open a new bug if the problem

The Fedora Legacy project (http://fedoralegacy.org/) maintains some older releases, 
and if you believe this bug is interesting to them, please report the problem in
the bug tracker at: http://bugzilla.fedora.us/

Note You need to log in before you can comment on or make changes to this bug.