classification
Title: asyncore does not check for EAGAIN and EPIPE errno
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: giampaolo.rodola Nosy List: giampaolo.rodola, josiahcarlson, mmarkk
Priority: normal Keywords: patch

Created on 2011-02-21 05:18 by mmarkk, last changed 2011-03-03 18:30 by mmarkk. This issue is now closed.

Files
File name Uploaded Description Edit
z.patch mmarkk, 2011-02-21 05:18
z.patch mmarkk, 2011-03-01 21:39 patch with EPIPE included
Messages (6)
msg128939 - (view) Author: Марк Коренберг (mmarkk) * Date: 2011-02-21 05:18
According to man:
----------------------
ERRORS
       EAGAIN or EWOULDBLOCK
The socket is marked nonblocking and no connections are present to be accepted.  POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities.
-----------------

patch included
msg129810 - (view) Author: Марк Коренберг (mmarkk) * Date: 2011-03-01 21:39
patch updated for handling EPIPE
msg129822 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-03-01 22:12
Ok for EAGAIN.

I'm not completely sure about EPIPE on recv() as it is not listed here:
http://www.kernel.org/doc/man-pages/online/pages/man2/recv.2.html
...although I think it's ok to treat it as an alias for connection lost anyway.

In pyftpdlib I treat both EPIPE and EBADF as disconnect events, and this works with both select() and poll().

Your patches should be targeted for python 3.3 (and not 2.x).
msg129835 - (view) Author: Josiah Carlson (josiahcarlson) * Date: 2011-03-01 23:57
Giampaolo pinged me over email...

These additional conditions look good, and should be targeted for 3.3 .

Thank you :)
msg129969 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-03-03 14:26
Fixed in r88722.
I did not catch EAGAIN in connect() as it makes hang some tests.
msg129991 - (view) Author: Марк Коренберг (mmarkk) * Date: 2011-03-03 18:30
> I did not catch EAGAIN in connect() as it makes hang some tests.
maybe incorrect tests? which test(s) failed ?

mmarkk@fad:/usr/include$ fgrep EWOULDB -r .
./asm-generic/errno.h:#define	EWOULDBLOCK	EAGAIN	/* Operation would block */

So not catching EAGAIN ( at least in Linux) can not make some tests hang.
History
Date User Action Args
2011-03-03 18:30:30mmarkksetnosy: josiahcarlson, giampaolo.rodola, mmarkk
messages: + msg129991
2011-03-03 14:26:22giampaolo.rodolasetstatus: open -> closed
versions: - Python 2.6
nosy: josiahcarlson, giampaolo.rodola, mmarkk
messages: + msg129969

resolution: fixed
2011-03-01 23:57:36josiahcarlsonsetnosy: + josiahcarlson
messages: + msg129835
2011-03-01 22:12:44giampaolo.rodolasetmessages: + msg129822
2011-03-01 21:39:49pitrousetassignee: giampaolo.rodola

nosy: + giampaolo.rodola
2011-03-01 21:39:05mmarkksetfiles: + z.patch

messages: + msg129810
title: asyncore does not check for EAGAIN errno -> asyncore does not check for EAGAIN and EPIPE errno
2011-02-21 05:19:13mmarkksettype: behavior
2011-02-21 05:18:50mmarkkcreate