Skip to content

Conversation

@HankStat
Copy link

Which issue this PR fixes
Fixes #625

Problem

The test is flaky in CI because the local transaction_timeout(20ms) is too tight to complete the update operation, leading to a context deadline exceeded error or spanner: code = "DeadlineExceeded"... error.

Solution

Increase the transaction_timeout to 1s and the MinimumExecutionTime to 1.5s.
I executed the tests by running 10,000 times with the -race flag:

  • transaction_timeout = 1s, Passed
  • transaction_timeout = 0.06s, Failed
  • transaction_timeout = 0.2s, Failed
  • transaction_timeout = 0.5s, Failed

Verification

The test now passes on my local machine after running it 10,000 times using a loop to simulate the flaky behavior within 10,521 seconds.

go test -v -count=10000 -race -run "TestTransactionTimeoutSecondStatement" -failfast -timeout=200m

I observed several pass tests taking 1.88s, 1.84s, and 1.81s with transaction_timeout = 1s, which proves that increasing transaction_timeout is necessary to prevent CI rerun.

@google-cla
Copy link

google-cla bot commented Nov 29, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@HankStat HankStat marked this pull request as ready for review November 29, 2025 04:29
@HankStat HankStat requested a review from a team as a code owner November 29, 2025 04:29
Problem:
The test is flaky in CI because the local transaction_timeout(20ms) is too tight to complete the update operation, leading to a `context deadline exceeded` error or `spanner: code = "DeadlineExceeded"...` error.

Solution:
By running the test 10,000 times with the -race flag, I found that only setting transaction_timeout to at least 1s passees 10,000 times. I have experimented with 0.06s, 0.2s, and 0.5s. However, all of them (0.06s, 0.2s, and 0.5s) fail before passing 10,000 times.

Signed-off-by: Yong-Han Chen <hank96015@gmail.com>
@HankStat HankStat force-pushed the flaky-TestTransactionTimeoutSecondStatement branch from 7842dbc to 5581be6 Compare November 29, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestTransactionTimeoutSecondStatement is (still) flaky

1 participant