fix(core): avoid panic if workflow stream still up during eviction - #1158
Merged
Merged
Conversation
chris-olszewski
commented
Mar 16, 2026
| // The stream may shut down after accepting the message but before processing | ||
| // it (e.g. an eviction reply racing with shutdown_done()). | ||
| // Empty complete which is likely an evict reply, we can just ignore as above. | ||
| return Ok(()); |
Member
Author
There was a problem hiding this comment.
I didn't include a request_eviction call here. I can add it if that makes sense, but I think the workflow stream will always be shut down if the response send side of the channel has been dropped.
chris-olszewski
marked this pull request as ready for review
March 16, 2026 22:48
Sushisource
approved these changes
Mar 16, 2026
Sushisource
left a comment
Member
There was a problem hiding this comment.
Nice, this fix makes sense. This one has been lurking forever and I never really found a satisfying way to fix it.
I kept trying to do this by ensuring that the other half of the channel never went away, which I do still think is sort of the "real" fix, but, at the same time if this was only ever happening with ignore_evicts_on_shutdown being set, then I really don't care and this is 100% fine.
chris-olszewski
force-pushed
the
olszewski/fix_flakey_ubuntu_arm
branch
from
March 16, 2026 23:49
cd9aca4 to
a592cab
Compare
This was referenced Apr 3, 2026
Closed
This was referenced May 1, 2026
Closed
This was referenced May 15, 2026
Closed
This was referenced Jun 5, 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.
What was changed
When the workflow stream has a zero-size cache (max_cached_workflows = 0) and ignore_evicts_on_shutdown = true (the default for tests), there is a race between stream shutdown and eviction completion processing.
After the final workflow activation completes, the zero-cache mechanism produces an eviction activation. When
initiate_shutdown()is called, it cancels the shutdown token and enqueues aBumpStreammessage into the local channel. If an eviction completion is enqueued afterBumpStream, the stream processes BumpStream first, seesshutdown_done() = true, and exits. This drops the eviction completion's response channel sender without fulfillingit. This causes
rx.awaitto returnErr, which triggersdbg_panic!in tests.For whatever reason, this only seemed to get hit on GitHub Action Ubuntu Arm runners.
Mirror the existing
send_local-failure handling for empty completions for the case if the stream shuts down afterWFActCompleteMsgwas sent.Why?
I've seen this test fail multiple times over the past week.
Checklist
Closes N/A
How was this tested:
Added
eviction_completion_during_shutdown_does_not_panicthat reproduces the race by exploiting FIFO ordering on the local channel. It usesmake_wft_stream_interminable()to preventPollerDeadfrom arriving, processes the full workflow, polls the eviction activation, then callsinitiate_shutdown()followed immediately by the eviction completion. This guarenteesBumpStreamis ahead ofWFActCompleteMsgin the channel. Without the fix the test panics with the same error seen in CI; with the fix it passes.Any docs updates needed?
N/A