Fix ThreadSanitizer data race and failed RPC calls#39076
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a concurrency issue identified by ThreadSanitizer within the AsyncWrapperTest suite. By ensuring the visibility of the time variable in the test's mock timer implementation, the change stabilizes test execution in multi-threaded environments. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the FakeTimer test helper class in AsyncWrapperTest.java by marking the time field as volatile to ensure thread-safe visibility. I have no feedback to provide as there are no review comments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
1731a42 to
af1cbfa
Compare
af1cbfa to
706fda3
Compare
706fda3 to
eedf291
Compare
|
Assigning reviewers: R: @damccorm for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
|
@damccorm While the AsyncWrapper Tests are no longer flaky, it produced a nightly sanitization bug (b/525779608). Additionally, BQ CA also identified a bug in the Python SDK's retry logic which also exists in my Java Wrapper (b/524749371. Both of these issues should be fixed in this pull request. And the flaky tests seem to be unrelated to the changes I made. Commit 1: Fixes the ThreadSanitizer (TSan) data race on the mock FakeTimer's time field in the test suite (Addresses b/525779608) Commit 2: Fixes a memory leak where failed futures were not removed from the in-memory cache, causing pipeline stalls on transient RPC retries. This is corrected in both the Python and Java wrappers, with unit tests added (Addresses b/524749371) |
| } | ||
|
|
||
| // Only mark as finished if get() succeeded without exception | ||
| finishedElementIds.add(elementId); |
There was a problem hiding this comment.
Looking at this - should we be adding to finishedElementIds if the future gets cancelled? Doesn't this mean that the task was not actually finished?
There was a problem hiding this comment.
Thanks for catching this! Yes, Cancelled futures should not be considered finished.
I have updated the logic in the latest commit to only add the element to finishedElementIds if the future completed successfully and was not cancelled.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #39076 +/- ##
============================================
+ Coverage 54.25% 54.34% +0.08%
Complexity 1715 1715
============================================
Files 1064 1065 +1
Lines 166973 167375 +402
Branches 1255 1255
============================================
+ Hits 90589 90953 +364
- Misses 74166 74204 +38
Partials 2218 2218
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This PR addresses two asynchronous processing wrapper issues:
Fixes b/525779608 (go/tsan bug)
Fixes b/524749371 (RPC retry bug)
R: @damccorm @AMOOOMA
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.