[issue30931] Race condition in asyncore wrongly closes channel

Jaume report at bugs.python.org
Fri Jul 14 12:44:08 EDT 2017


New submission from Jaume:

If a socket is closed and polled here https://github.com/python/cpython/blob/0d0a32fb91cdfea1626e6c6b77a9bc44e15a2b8a/Lib/asyncore.py#L183 the flag returned will be select.POLLNVAL (note that this can happen despite dispatcher.close() being called).

This wouldn't be a problem but before here https://github.com/python/cpython/blob/0d0a32fb91cdfea1626e6c6b77a9bc44e15a2b8a/Lib/asyncore.py#L185 a new socket may be created with the same fd (which wouldn't be strange since that fd is now available), so the retrieved socket will be the newly created one instead of the old one and the new one will be close.

This is regularly happening to us, I could try to explain better, but that's really it.

----------
messages: 298359
nosy: walkhour
priority: normal
severity: normal
status: open
title: Race condition in asyncore wrongly closes channel
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30931>
_______________________________________


More information about the Python-bugs-list mailing list