Skip to content

Conversation

@cretz
Copy link
Member

@cretz cretz commented Jan 6, 2026

What was changed

Today in places where we wait in a workflow, like wait_condition, we store the Fiber.current on a hash then we Fiber.yield. But when the yield was interrupted by say a timeout or other raised error, we were not properly removing the fiber from the hash. Therefore, later when code happened that would have caused the fiber to properly be resolved, it is obtained from the hash and resumed. But it is no longer yielding there and may be yielding somewhere else. This isn't just wait_condition + timeout, this could happen if you interrupted waiting for activity completion or anything similar to that too.

So where we do this, we updated to make the ensure block after a Fiber.yield remove the fiber reference from the hash so we do not inadvertently resume it later.

This is a fairly rare situation, basically only happens on interrupted fiber yields (basically a fiber raise like Workflow.timeout does). We added a test to prove this situation exists and the fix fixes it for wait condition (did not add tests for every permutation of yield we have).

Checklist

  1. Closes ## Bug Report: Fiber state corruption after Workflow.timeout expires on x86_64 #373

@cretz cretz requested a review from a team as a code owner January 6, 2026 22:33
Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed write up, it was very helpful.

@cretz cretz merged commit 7fe3beb into temporalio:main Jan 7, 2026
7 checks passed
@cretz cretz deleted the leftover-wait branch January 7, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

## Bug Report: Fiber state corruption after Workflow.timeout expires on x86_64

2 participants