Skip to content

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

@kristjanvalur

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions