Bug 58824 - write(2) can block despite fd being non-blocking
Summary: write(2) can block despite fd being non-blocking
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 6.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL: http://www.chiark.greenend.org.uk/~pe...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-01-25 10:13 UTC by peter.benie
Modified: 2008-08-01 16:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-09-30 15:39:21 UTC
Embargoed:


Attachments (Terms of Use)

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/



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