Skip to content

[3.6] bpo-26819: Prevent proactor double read on resume (GH-6921)#7110

Merged
asvetlov merged 1 commit into
python:3.6from
CtrlZvi:backport-4151061-3.6
May 25, 2018
Merged

[3.6] bpo-26819: Prevent proactor double read on resume (GH-6921)#7110
asvetlov merged 1 commit into
python:3.6from
CtrlZvi:backport-4151061-3.6

Conversation

@CtrlZvi

@CtrlZvi CtrlZvi commented May 25, 2018

Copy link
Copy Markdown
Contributor

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..
(cherry picked from commit 4151061)

Co-authored-by: CtrlZvi viz+github@flippedperspective.com

https://bugs.python.org/issue26819

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..
(cherry picked from commit 4151061)

Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
@bedevere-bot

Copy link
Copy Markdown

@asvetlov: Please replace # with GH- in the commit message next time. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants