[Failing Test]: SqsIOWriteBatchesTest is flaky (Mockito ArgumentsAreDifferent in timeout-related tests)
What happened?
org.apache.beam.sdk.io.aws2.sqs.SqsIOWriteBatchesTest is flaky in the beam_PreCommit_Java_Amazon-Web-Services2_IO_Direct workflow. Different test methods of the same class fail intermittently with Mockito verification errors (org.mockito.exceptions.verification.junit.ArgumentsAreDifferent), which points to a timing-sensitive interaction with the batching/timeout logic under test:
testWriteBatchesWithTimeout— https://github.com/apache/beam/actions/runs/27417091199/job/81032556571 (2026-06-12, PR #38493:369 tests completed, 1 failed)testWriteBatchesToDynamicWithTimeoutandtestWriteBatchesToDynamicWithStrictTimeout— observed earlier on PR #38255 runs (2026-04-28, e.g. commitse8e107ce,b344c3ca, see https://github.com/apache/beam/pull/38255#issuecomment-4333407773)
The job is green on most master runs (last several scheduled runs passed), so this is an intermittent flake rather than a consistent breakage, but it has been recurring for months and regularly turns unrelated PRs red.
Issue Priority
Priority: 2 (default / most failing tests should be filed as P2)
Issue Components
- [ ] Component: Python SDK
- [X] Component: Java SDK
Hi, I'd like to investigate this test issue. Before I start, do we currently have a reliable way to reproduce the failures locally (e.g. specific Gradle/Maven commands, repeated test runs, or known stress settings)or is reproducing the flake itself part of the investigation?
Hi @Kriti-dev07, thanks and sorry for the late reply. I opened a fix in #38971, it is waiting for review, so I think there is no need to spend time on this one.
There is no reliable local repro, I believe. The tests race a Thread.sleep against withBatchTimeout, so they only fail under load. Running SqsIOWriteBatchesTest in a loop on a busy machine triggers it eventually.