Skip to content

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

Merged
miss-islington merged 1 commit into
python:3.7from
miss-islington:backport-4151061-3.7
May 20, 2018
Merged

[3.7] bpo-26819: Prevent proactor double read on resume (GH-6921)#7004
miss-islington merged 1 commit into
python:3.7from
miss-islington:backport-4151061-3.7

Conversation

@miss-islington

@miss-islington miss-islington commented May 20, 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>
@miss-islington

Copy link
Copy Markdown
Contributor Author

@CtrlZvi and @asvetlov: Backport status check is done, and it's a success ✅ .

@miss-islington

Copy link
Copy Markdown
Contributor Author

Thanks!

@miss-islington miss-islington deleted the backport-4151061-3.7 branch May 20, 2018 10:57
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.

5 participants