Skip to content

Fix "Task polled after completion" panic (#60693) (cherry-pick to stable) - #60935

Merged
eholk merged 1 commit into
v1.10.xfrom
cherry-pick-v1.10.x-2c4e4470
Jul 14, 2026
Merged

Fix "Task polled after completion" panic (#60693) (cherry-pick to stable)#60935
eholk merged 1 commit into
v1.10.xfrom
cherry-pick-v1.10.x-2c4e4470

Conversation

@eholk

@eholk eholk commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Cherry-pick of #60693 to stable


Dropping a scheduled runnable cancels its task and makes the next poll
of any awaiter panic with "Task polled after completion." The only paths
where we drop these runnables seem to be during shutdown or extreme
resource exhaustion, so, let's leak the runnables instead of crashing.

On Windows, we also moved to calling the Win32 thread pool API directly,
because 1) WinRT thread pool API is just a wrapper that adds overhead we
don't need, and 2) the closure we pass to the WorkItemHandler object
takes ownership of the runnable object, so if the WinRT thread pool
releases the delegate, it can free the runnable without our control.

Release Notes:

  • N/A

Dropping a scheduled runnable cancels its task and makes the next poll
of any awaiter panic with "Task polled after completion." The only paths
where we drop these runnables seem to be during shutdown or extreme
resource exhaustion, so, let's leak the runnables instead of crashing.

On Windows, we also moved to calling the Win32 thread pool API directly,
because 1) WinRT thread pool API is just a wrapper that adds overhead we
don't need, and 2) the closure we pass to the `WorkItemHandler` object
takes ownership of the runnable object, so if the WinRT thread pool
releases the delegate, it can free the runnable without our control.

Release Notes:

- N/A
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 13, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jul 13, 2026
@eholk
eholk enabled auto-merge (squash) July 13, 2026 23:52
@eholk
eholk disabled auto-merge July 13, 2026 23:52
@cole-miller

Copy link
Copy Markdown
Member

@zed-industries/approved

@eholk
eholk merged commit 9d49b23 into v1.10.x Jul 14, 2026
46 checks passed
@eholk
eholk deleted the cherry-pick-v1.10.x-2c4e4470 branch July 14, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants