]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-26819: Prevent proactor double read on resume (#6921)
authorCtrlZvi <viz+github@flippedperspective.com>
Sun, 20 May 2018 10:21:10 +0000 (03:21 -0700)
committerAndrew Svetlov <andrew.svetlov@gmail.com>
Sun, 20 May 2018 10:21:10 +0000 (13:21 +0300)
commit4151061855b571bf8a7579daa7875b8e243057b9
tree67475c5547ab6d6b4ebc9a9dbbd9fd769aeee0f3
parentf5e7b1999f46e592d42dfab51563ea5411946fb7
bpo-26819: Prevent proactor double read on resume (#6921)

The proactor event loop has a race condition when reading with
pausing/resuming. `resume_reading()` unconditionally schedules the read
function to read from the current future. If `resume_reading()` was
called before the previously scheduled done callback fires, this results
in two attempts to get the data from the most recent read and an
assertion failure. This commit tracks whether or not `resume_reading`
needs to reschedule the callback to restart the loop, preventing a
second attempt to read the data.
Lib/asyncio/proactor_events.py
Lib/test/test_asyncio/test_proactor_events.py
Misc/NEWS.d/next/Library/2018-05-16-05-24-43.bpo-26819.taxbVT.rst [new file with mode: 0644]