Staging
v0.8.1
v0.8.1
https://github.com/python/cpython
Revision d5aeccf9767c1619faa29e8ed61c93bde7bc5e3f authored by Victor Stinner on 31 August 2014, 13:07:57 UTC, committed by Victor Stinner on 31 August 2014, 13:07:57 UTC
There is a race condition in create_connection() used with wait_for() to have a timeout. sock_connect() registers the file descriptor of the socket to be notified of write event (if connect() raises BlockingIOError). When create_connection() is cancelled with a TimeoutError, sock_connect() coroutine gets the exception, but it doesn't unregister the file descriptor for write event. create_connection() gets the TimeoutError and closes the socket. If you call again create_connection(), the new socket will likely gets the same file descriptor, which is still registered in the selector. When sock_connect() calls add_writer(), it tries to modify the entry instead of creating a new one. This issue was originally reported in the Trollius project, but the bug comes from Tulip in fact (Trollius is based on Tulip): https://bitbucket.org/enovance/trollius/issue/15/after-timeouterror-on-wait_for This change fixes the race condition. It also makes sock_connect() more reliable (and portable) is sock.connect() raises an InterruptedError.
1 parent 41f3c3f
Tip revision: d5aeccf9767c1619faa29e8ed61c93bde7bc5e3f authored by Victor Stinner on 31 August 2014, 13:07:57 UTC
asyncio, Tulip issue 205: Fix a race condition in BaseSelectorEventLoop.sock_connect()
asyncio, Tulip issue 205: Fix a race condition in BaseSelectorEventLoop.sock_connect()
Tip revision: d5aeccf
File | Mode | Size |
---|---|---|
Doc | ||
Grammar | ||
Include | ||
Lib | ||
Mac | ||
Misc | ||
Modules | ||
Objects | ||
PC | ||
PCbuild | ||
Parser | ||
Python | ||
Tools | ||
.bzrignore | -rw-r--r-- | 584 bytes |
.gitignore | -rw-r--r-- | 960 bytes |
.hgeol | -rw-r--r-- | 800 bytes |
.hgignore | -rw-r--r-- | 1.2 KB |
.hgtags | -rw-r--r-- | 6.6 KB |
.hgtouch | -rw-r--r-- | 1.2 KB |
LICENSE | -rw-r--r-- | 12.5 KB |
Makefile.pre.in | -rw-r--r-- | 53.8 KB |
README | -rw-r--r-- | 6.6 KB |
config.guess | -rwxr-xr-x | 41.9 KB |
config.sub | -rwxr-xr-x | 34.9 KB |
configure | -rwxr-xr-x | 438.3 KB |
configure.ac | -rw-r--r-- | 138.5 KB |
install-sh | -rwxr-xr-x | 7.0 KB |
pyconfig.h.in | -rw-r--r-- | 40.1 KB |
setup.py | -rw-r--r-- | 95.2 KB |
Computing file changes ...