Repository navigation
Fix workflow eviction after activation timeouts - #2013
Closed
nijanthanh wants to merge 1 commit into
Closed
nijanthanh wants to merge 1 commit into
nijanthanh wants to merge 1 commit into
Conversation
|
|
Contributor
|
Please elaborate on the actual issue you ran into. The description provided really doesn't give a concrete thing it is actually intended to prevent. You should file an issue with a more precise description before opening an intricate PR. |
Author
|
My bad - was looking to create PR to understand what a potential fix would like. Didn't intend to notify you folks. Yes, will raise a more detailed issue. Thanks! |
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
A workflow activation timeout currently cancels the asyncio executor future even though its thread may still be running. Safe eviction can consequently start another activation on the same instance and acknowledge eviction before the original execution exits. Separately, cleanup that succeeds during the retry delay is submitted again because the retry loop treats every completed future as a reason to retry.
Use non-cancelling waits and consume the executor result before deciding whether to retry:
TimeoutErrorfrom expiration of the deadlock timer.Safe eviction still waits for a permanently blocked thread; this change does not forcibly terminate threads or disable safe eviction.
Validation
On macOS ARM64 / Python 3.12, with the native bridge built from the pinned Core revision:
poe lint— passed, including Ruff, Pyright, mypy, basedpyright, and docstyle.poe test -n 0 tests/worker/test_workflow_eviction_unit.py— 8 passed.poe test -n 0 tests/worker/test_workflow_eviction.py— 3 passed as part of the focused regression run.poe test -n 0 tests/worker/test_workflow.py -k 'deadlock or eviction'— 8 passed.The three new integration cases and the strengthened uninterruptible-deadlock test all failed on the unmodified baseline and passed with this change. Coverage includes overlapping activation prevention, success during retry backoff, premature eviction acknowledgment, actual deadlock interruption, completed execution failures, and handler cancellation.