Skip to content

mvcc: Deflake TestWatchVictims with synctime - #22269

Open
Hrishi-Baskaran wants to merge 1 commit into
etcd-io:mainfrom
Hrishi-Baskaran:deflake-watch-victims
Open

mvcc: Deflake TestWatchVictims with synctime#22269
Hrishi-Baskaran wants to merge 1 commit into
etcd-io:mainfrom
Hrishi-Baskaran:deflake-watch-victims

Conversation

@Hrishi-Baskaran

@Hrishi-Baskaran Hrishi-Baskaran commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Resolves #22266

Uses the synctest package to remove nondeterminism from the TestWatchVictims. The main issue with TestWatchVictims was the use of a wall clock 10 second timeout on Watch operations as a naive deadlock detection mechanism. On slow CI machines this may not be enough, on fast CI machines this may be too long, slowing down the test. I was able to replicate this with stress

    watchable_store_test.go:944: time out

(see log with more context in the issue)

This PR replaced the above mechanism with a more deterministic one by running relevant code in a synctest bubble which can halt or advance time arbitrarily depending on the current state of the synctest bubble.

The end result is a test that will quickly detect a deadlock on a fast machine but will not report a deadlock if goroutines are advancing, even on a slow machine.

This also helps enforce the goal of the test that Puts should happen faster than Watch events by back pressuring Watch events with simulated time. This was previously done with wall clock time which is not as reliable and can slow down fast CI machines.

The overall changes improve both determinism and performance of this test.

@kubernetes-prow

Copy link
Copy Markdown

Hi @Hrishi-Baskaran. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Hrishi-Baskaran
Once this PR has been reviewed and has the lgtm label, please assign jmhbnz for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Uses the synctest package to deterministicly test concurrent code that
relies on time. Replaced the 10s timeout for Watch operations for a less
flaky deadlock detector goroutine inside of a synctest bubble.

Signed-off-by: Hrishi Baskaran <hrishithevar@gmail.com>
@Hrishi-Baskaran Hrishi-Baskaran changed the title Deflake TestWatchVictims Deflake TestWatchVictims with synctime Aug 11, 2026
@Hrishi-Baskaran Hrishi-Baskaran changed the title Deflake TestWatchVictims with synctime mvcc: Deflake TestWatchVictims with synctime Aug 11, 2026
@Hrishi-Baskaran

Copy link
Copy Markdown
Contributor Author

/assign @serathius

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Flaky TestWatchVictims

2 participants