Skip to content

gh-109934: notify cancelled futures on thread pool shutdown #134618

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

duaneg
Copy link
Contributor

@duaneg duaneg commented May 24, 2025

When ThreadPoolExecutor shuts down it cancels any pending futures, however at present it doesn't notify waiters. Thus their state stays as CANCELLED instead of CANCELLED_AND_NOTIFIED and any waiters are not awakened.

Call set_running_or_notify_cancel on the cancelled futures to fix this.

When `ThreadPoolExecutor` shuts down it cancels any pending futures, however at
present it doesn't notify waiters. Thus their state stays as `CANCELLED`
instead of `CANCELLED_AND_NOTIFIED` and any waiters are not awakened.

Call `set_running_or_notify_cancel` on the cancelled futures to fix this.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant