Skip to content

Race between asyncio Condition.notify() and Task.cancel() may result in lost wakeups. #112202

Description

@kristjanvalur

Bug report

Bug description:

A Task which issues a condition.notify(1) to wake up a Task from a set of waiting tasks to perform some task, e.g. consume a piece of data, may hit a race condition with a simultaneous cancel() of a task among the waiting tasks, resulting in none of the tasks
successfully returning from cond.wait(). This is problematic because because the notify() is essentially lost, and starvation/deadlocks may occur.

PR #112201 contains a fix, as well as documentation updates

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Activity

  1. added a commit that references this issue on Feb 3, 2024
  2. gvanrossum commented on Feb 3, 2024

    @gvanrossum
    Member

    @kristjanvalur Thanks for your work on this!

  3. moved this from Todo to Done in asyncioon Feb 3, 2024
  4. added a commit that references this issue on Feb 11, 2024
  5. added a commit that references this issue on Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions