damccorm opened a new pull request, #41824:
URL: https://github.com/apache/beam/pull/41824
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
Re-proposes the fix from #41207 (which was closed on 2026-11-24 because the
test-only flake had only occurred once) now that the exact failure has occurred
a **2nd time** (`>= 2` observed failures):
- [PostCommit Python Versions run
42902232829](https://github.com/apache/beam/actions/runs/42902232829)
- [PreCommit Python Runners run
46536231939](https://github.com/apache/beam/actions/runs/46536231939/job/142262785380)
(build scan https://develocity.apache.org/s/idnokdek72uqq)
## Root Cause
In `InteractiveBeamComputeTest.test_async_computation_result_cancel`,
`ib.compute(pcoll, blocking=False)` starts a real background thread in
`RecordingManager._executor` executing `time.sleep(100)` on `DirectRunner`,
mocks `pipeline_result.cancel()`, and exits after ~1.1s without waiting for the
background thread to complete. The leaked thread continues executing during the
immediately following `test_compute_blocking` test on the same pytest-xdist
worker (`[gw3]`), mutating `InteractiveEnvironment`'s pipeline tracker so
`ib.compute(pcoll, blocking=True)` raises `ValueError: All PCollections must
belong to the same pipeline.` at `interactive_beam.py:1081`.
## Changes
- Shortened `time.sleep(100)` to `time.sleep(3)` in
`InteractiveBeamComputeTest.test_async_computation_result_cancel`
(`sdks/python/apache_beam/runners/interactive/interactive_beam_test.py`) so the
1s `TimeoutError` assertion still exercises an in-flight computation.
- Added `async_result.wait_for_completion(timeout=30)` before returning so
no background computation thread leaks into the next test.
## Verification
- Same 3-line diff previously passed `InteractiveBeamComputeTest` (17/17),
`PreCommit Python Formatter`, and `PostCommit Python Versions` ([run
43440309029](https://github.com/apache/beam/actions/runs/43440309029)) on
#41207.
- Triggering `beam_PreCommit_Python_Runners.yml` on this branch.
### Verification
- Triggered `.github/workflows/beam_PreCommit_Python_Runners.yml` workflow
run on branch:
[`46552439385`](https://github.com/apache/beam/actions/runs/46552439385)
--
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]