Repository navigation
Fix cluster shutdown waiting on queued persisted workflow activities - #9817
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 76d1894 The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
…registration closes
Flatten the persisted-interrupt branch in the entity manager so the replay, retry and respond paths read in order, and share the resume logic between the two reply-handler unregister functions.
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
During cluster shutdown, a workflow could hold the entity drain until
entityTerminationTimeoutwhen itsrunhandler was waiting on a persisted activity request that had been saved but not started.The
runhandler is uninterruptible. It waits on the local reply handler for the activity, so the entity's RpcServer never sendsClientEnd, and the drain waits onendLatchuntil the timeout. The only shutdown step that released that waiter (unregisterShardReplyHandlers(shardId, { interrupt: true })) runs after the drain finishes, so the two waited on each other.Changes
Eof, the entity manager calls a new internalabandonUndeliveredhook. Only during runner shutdown, Sharding abandons local callers parked on persisted requests to that address that the entity never started. This uses the sameClusterAbandoninterrupt thatsendOutgoingalready uses for new sends that cannot be served. Callers on a runner that keeps running, for example when only the target entity type's registration closes, are not touched and stay durable. The hook runs beforeEofso it is not skipped when the drain's end latch is already open, for example after a handler crash.Uninterruptibleones.MessageStorage.unregisterReplyHandleraccepts an optional{ interrupt?: boolean }, matchingunregisterShardReplyHandlers.Known limitation
With
preemptiveShutdown: false, entities drain before the runner is marked as shutting down, so the hook does not run. A workflow waiting on a queued persisted activity therefore still holds shutdown untilentityTerminationTimeout, as before this PR. New persisted sends made while the target entity type is closing have the same pre-existing gap. The default configuration (preemptiveShutdown: true) is fixed.Tests
ClusterWorkflowEngine.test.ts:Sharding.test.ts:Sharding.test.ts: an ordinary durable caller survives when only its target's registration closes (preemptiveShutdown: false) and replays after a restart.Closes #9816
Closes EFF-2835