Skip to content

Issues when Condition.notify() is interrupted #92530

Description

@serhiy-storchaka

If threading.Condition.notify() is interrupted just after it releases the waiter lock, but before remove it from the queue, the following calls of notify() will fail with RuntimeError: cannot release un-acquired lock. It can block the waiter threads if they do not use timeout.

cpython/Lib/threading.py

Lines 375 to 380 in 5bc2390

for waiter in waiters_to_notify:
waiter.release()
try:
all_waiters.remove(waiter)
except ValueError:
pass

The simplest solution would be to silence a RuntimeError in waiter.release(). There may be similar issues in other parts of the code.

Activity

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

Metadata

Metadata

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions