[Python-bugs-list] [ python-Bugs-629097 ] Race condition in asyncore poll

noreply@sourceforge.net noreply@sourceforge.net
Sat, 26 Oct 2002 07:48:09 -0700


Bugs item #629097, was opened at 2002-10-26 14:48
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=629097&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Steve Alexander (stevea_zope)
Assigned to: Nobody/Anonymous (nobody)
Summary: Race condition in asyncore poll

Initial Comment:
In the following post to the Zope 3 developers' list, I
describe a race condition in the poll method of asyncore.

http://lists.zope.org/pipermail/zope3-dev/2002-October/003091.html

The problem is this:

There is a global dict socket_map. In the poll method,
socket_map is processed into appropriate arguments for
a select.select call. However, if a socket that is
represented socket_map is closed during the time
between the processing of socket_map and the
select.select call, that call will fail with a Bad File
Descriptor (EBADF) error.

One solution is to patch asyncore to catch EBADF errors
raised by select.select, and at that point see if the
file descriptors in the current version of socket_map 
are the same as in the processed data used for the
select.select call. If they are the same, re-raise the
error, otherwise, ignore the error.

In another email to the Zope 3 developers' list, Jeremy
Hylton queries whether there are any other similar
problems in asyncore.

http://lists.zope.org/pipermail/zope3-dev/2002-October/003093.html


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=629097&group_id=5470