[New-bugs-announce] [issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

Alexander Mohr report at bugs.python.org
Tue Nov 10 02:16:34 EST 2015

New submission from Alexander Mohr:

asyncio.selector_events.BaseSelectorEventLoop._sock_connect_cb is a callback based on the selector for a socket. There are certain situations when the selector triggers twice calling this callback twice, resulting in an InvalidStateError when it sets the Future to None.  The way I triggered this was by having several parallel connections to the same host in a multiprocessing script. I suggest analyzing why this callback can be called twice and figuring out what the correct fix is.  I monkey patched it by adding a fut.done() check at the top.  If this information is not enough I can try to provide a sample script. Its currently reproducing in a fairly involved multiprocessing script.

components: asyncio
messages: 254433
nosy: gvanrossum, haypo, thehesiod, yselivanov
priority: normal
severity: normal
status: open
title: _sock_connect_cb can be called twice resulting in InvalidStateError
type: behavior
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list