Bug 58824

Summary: write(2) can block despite fd being non-blocking
Product: [Retired] Red Hat Linux Reporter: peter.benie
Component: kernelAssignee: Arjan van de Ven <arjanv>
Status: CLOSED CURRENTRELEASE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: alan
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://www.chiark.greenend.org.uk/~peterb/linux/nonblock/
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-09-30 15:39:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description peter.benie 2002-01-25 10:13:42 UTC
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 10:18:36 UTC
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 11:03:29 UTC
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 13:42:24 UTC
The tty one is fixed in 2.4.18-ac and  pushed on to Marcelo


Comment 4 Bugzilla owner 2004-09-30 15:39:21 UTC
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
persists.

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/