Repository navigation
test: make the concurrent cancelation e2e test deterministic - #523
Merged
Merged
Conversation
The cancelation raced with an artifact update every 5ms. Each retry deep-copies the whole task twice, so under -race and CPU load the cancelation lost all 10 retries once the task had grown to about 50-90 artifacts, and the test then hung until the client timeout. The execution now starts writing artifacts after CancelTask returned. The execution also reports its context cause when its last write fails because the context was canceled. Before, the test then waited for the cause until the go test timeout.
yarolegovich
added a commit
that referenced
this pull request
Nov 4, 2026
* When a cancelation loses every optimistic concurrency retry to a concurrent execution, the processor no longer moves the task to `FAILED`. The retry error wraps `taskstore.ErrConcurrentModification` now, so `CancelTask` fails with that error and the task keeps running, as for other concurrent modifications (#245). This affects cancels handled by a server instance other than the one running the execution, and every cancel in cluster mode. A cancel handled by the instance running the execution goes through the execution's pipe and doesn't race. Such a cancel can still lose every retry when the store's read and update take longer than the interval between the execution's updates, for example with a fast event stream and a slow store. More attempts don't help in that case because the conflicts are correlated, so fixing it needs a different way to signal cancelation and is not part of this PR. Found through the flaky `TestConcurrentCancellation_ExecutionResolvesToCanceledTask`, which #523 makes deterministic.
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.
TestConcurrentCancellation_ExecutionResolvesToCanceledTaskstarts writing artifacts only afterCancelTaskreturned. Before, the cancelation raced with an artifact update every 5ms, and under-raceand CPU load it lost all 10 optimistic concurrency retries once the task had grown to about 50–90 artifacts, because each attempt deep-copies the whole task twice.go testtimeout.With 32 parallel
-raceprocesses, the old test failed in 28 of 32 processes, and the new one passed 2,880 runs. Some of the lost-retry failures left the taskFAILED, which is fixed in #522.