[issue30931] Race condition in asyncore wrongly closes channel
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 <http://bugs.python.org/issue30931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30931] Race condition in asyncore wrongly closes channel
Changes by Jaume : -- type: -> resource usage versions: +Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <http://bugs.python.org/issue30931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30931] Race condition in asyncore wrongly closes channel
Changes by Jaume : -- pull_requests: +2771 ___ Python tracker <http://bugs.python.org/issue30931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30931] Race condition in asyncore wrongly closes channel
Changes by Jaume : -- pull_requests: +2823 ___ Python tracker <http://bugs.python.org/issue30931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30985] Set closing variable in asyncore at close
Changes by Jaume : -- nosy: walkhour priority: normal severity: normal status: open title: Set closing variable in asyncore at close ___ Python tracker <http://bugs.python.org/issue30985> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30985] Set closing variable in asyncore at close
Changes by Jaume : -- pull_requests: +2854 ___ Python tracker <http://bugs.python.org/issue30985> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30931] Race condition in asyncore may access the wrong dispatcher
Jaume added the comment: There's an alternative fix which follows a similar approach to the one you mention: https://github.com/python/cpython/pull/2707/. I personally don't like too much to reuse again again an old variable as it's true that we don't know how people are using it (although I take they use it as a boolean since it's assigned to False). On the other side this approach copies the map when it's not strictly necessary to do use just because we can't do it the proper way by using closing, as shown in the PR using it: https://github.com/python/cpython/pull/2764/files -- ___ Python tracker <http://bugs.python.org/issue30931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com