damccorm opened a new pull request, #41781:
URL: https://github.com/apache/beam/pull/41781

   Note: this PR was auto-generated by tooling. Before moving it out of draft, 
the author has done a full review of the PR, specifically evaluating it on the 
following criteria:
   
   - The PR is an appropriate fix for the issue (e.g. we're not changing a test 
to avoid a bug)
   - The PR is a simple fix to the issue (e.g. we're not adding infra when we 
could just modify a test)
   - The PR is not covering for other problems (e.g. if we're bumping timeouts, 
it is not because we're covering for a performance problem)
     
   Full details of the methodology of generation and review can be found here - 
https://docs.google.com/document/d/14lj7ECVov4T4EdwmIzNlWrRGE3lLDMOwX5xUMGzaLoc/edit?usp=sharing
   
   If you have concerns with the PR or with the underlying methodology used to 
generate this, please comment below - they will be addressed by the author not 
the tooling :)
   
   ## Summary
   
   Fixes a shutdown race in 
`StreamingEngineWorkCommitterTest.testStop_drainsCommitQueue` 
(`StreamingEngineWorkCommitterTest.java:402`: `expected to be false` on 
`assertThat(completeCommit.retryableFailure()).isFalse()`) in 
https://github.com/apache/beam/actions/runs/46440734716 (build scan 
https://develocity.apache.org/s/ld456joercofg).
   
   ## Root Cause
   
   `fakeCommitWorkStream.batcher()` returned a stub `RequestBatcher` whose 
`commitWorkItem()` always returned `false`. Whenever the 
`streamingCommitLoop()` sender thread dequeued `initialCommit` before 
`workCommitter.stop()` flipped `isRunning` to `false` 
(`StreamingEngineWorkCommitter.java:127`), `tryAddToCommitBatch()` returned 
`false` and threw `AssertionError` at line 201 (which bypasses `catch 
(Exception e)` at line 206). Its `finally` block (`lines 210-213`) then called 
`failQueuedCommit(initialCommit)` while `isRunning.get()` was still `true`, 
skipping `w.setFailed()` and emitting `CompleteCommit(..., ABORTED, 
retryableFailure=true)`.
   
   ## Changes
   
   - `StreamingEngineWorkCommitterTest.java`: Block inside 
`fakeCommitWorkStream.batcher()` on `new CountDownLatch(1).await()` until 
`workCommitter.stop()` sets `isRunning = false` and interrupts the sender 
thread via `commitSenders.shutdownNow()`, then restore the interrupt flag and 
throw `IllegalStateException` (caught by `streamingCommitLoop()`, exiting the 
loop cleanly and running `failQueuedCommit` with `isRunning == false`).
   
   ### Verification
   - Triggered `beam_PreCommit_Java_Dataflow.yml` workflow run on branch: 
[`46453157553`](https://github.com/apache/beam/actions/runs/46453157553)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to