fix(core): abort stale start_to_close timer on local activity retry - #1465
Open
sachinsharma3191 wants to merge 1 commit into
Open
fix(core): abort stale start_to_close timer on local activity retry#1465sachinsharma3191 wants to merge 1 commit into
sachinsharma3191 wants to merge 1 commit into
Conversation
When a local activity is retried, `mark_started()` overwrites the `start_to_close_handle` with a new timer without aborting the old one. Dropping a `JoinHandle` in tokio does not abort the task, so the stale timer continues running and can fire a spurious `StartToClose` timeout against a later attempt. Fix: `take()` + `abort()` the previous handle before spawning the new timer in `mark_started()`. Closes temporalio#1454
jtwillis92
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mark_started()inTimeoutBagoverwritesstart_to_close_handlewithout aborting the old tokio task. Since dropping aJoinHandledoes not abort the underlying task, the stale timer keeps running and can fire a spuriousStartToClosetimeout against a later retry attempt.take()+abort()the previous handle before spawning the new timer inmark_started().start_to_closetimeout, fails the first attempt after 100ms (so the first timer has ~100ms remaining), dispatches a retry (which spawns a fresh 200ms timer), then verifies no spurious timeout fires in the window where only the stale timer would have expired.Closes #1454
Test plan
retry_does_not_fire_stale_start_to_close_timer— passes with fix, fails without it (verified by temporarily reverting)local_activities::testspasstemporalio-sdk-corelib test suite (389 tests) passes