Fix activity retry expiration time not recalculated on workflow reset#10671
Open
NasitSony wants to merge 1 commit into
Open
Fix activity retry expiration time not recalculated on workflow reset#10671NasitSony wants to merge 1 commit into
NasitSony wants to merge 1 commit into
Conversation
When failInflightActivity resets a workflow, it overwrites ScheduledTime and FirstScheduledTime to the reset time, but RetryExpirationTime was not recalculated. This caused the expiration time to be earlier than the new scheduled time, making activities appear expired immediately after reset. Fix: compute the retry duration (RetryExpirationTime - ScheduledTime) before overwriting ScheduledTime, then set: RetryExpirationTime = resetTime + duration This preserves the original schedule-to-close timeout duration relative to the new scheduled time. Fixes temporalio#6952
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.
When failInflightActivity resets a workflow, it overwrites ScheduledTime and FirstScheduledTime to the reset time, but RetryExpirationTime was not recalculated. This caused the expiration time to be earlier than the new scheduled time, making activities appear expired immediately after reset.
Fix: compute the retry duration (RetryExpirationTime - ScheduledTime) before overwriting ScheduledTime, then set:
RetryExpirationTime = resetTime + duration
This preserves the original schedule-to-close timeout duration relative to the new scheduled time.
Fixes #6952
What changed?
In
failInflightActivity, recalculateRetryExpirationTimebased on the reset time before overwriting
ScheduledTime.Why?
When a workflow is reset,
failInflightActivityoverwritesScheduledTimeandFirstScheduledTimeto the reset time,but
RetryExpirationTimewas left unchanged. This causedthe expiration time to be earlier than the new scheduled time,
making activities appear expired immediately after reset —
preventing retries from occurring.
The fix preserves the original schedule-to-close timeout
duration relative to the new reset time:
duration = RetryExpirationTime - ScheduledTime
RetryExpirationTime = resetTime + duration
This must be computed before
ScheduledTimeis overwrittento preserve the original duration.
Fixes #6952
How did you test it?
Potential risks
Low — only affects activities with a retry expiration time
set (
RetryExpirationTime != nil). Activities without aretry policy are unaffected. Preserves the original
schedule-to-close timeout duration relative to reset time.