Skip to content

fix(core): abort stale start_to_close timer on local activity retry - #1465

Open
sachinsharma3191 wants to merge 1 commit into
temporalio:mainfrom
sachinsharma3191:fix/1454-stale-la-start-to-close-timer
Open

fix(core): abort stale start_to_close timer on local activity retry#1465
sachinsharma3191 wants to merge 1 commit into
temporalio:mainfrom
sachinsharma3191:fix/1454-stale-la-start-to-close-timer

Conversation

@sachinsharma3191

Copy link
Copy Markdown

Summary

  • Bug: mark_started() in TimeoutBag overwrites start_to_close_handle without aborting the old tokio task. Since dropping a JoinHandle does not abort the underlying task, the stale timer keeps running and can fire a spurious StartToClose timeout against a later retry attempt.
  • Fix: take() + abort() the previous handle before spawning the new timer in mark_started().
  • Regression test: Schedules a local activity with a 200ms start_to_close timeout, 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

  • New unit test retry_does_not_fire_stale_start_to_close_timer — passes with fix, fails without it (verified by temporarily reverting)
  • All 15 existing local_activities::tests pass
  • Full temporalio-sdk-core lib test suite (389 tests) passes

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
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.

Local activity: stale start_to_close timer from an earlier attempt is not aborted and can cancel a later attempt

2 participants