[Prism] Fix race condition in element manager#38734
Conversation
Ensures 'refreshCond.Broadcast()' is fully synchronized with
its mutex lock 'refreshCond.L' during pipeline termination and
processing-time timer scheduling ('wakeUpAt').
This avoids race conditions causing lost wake-up signals and
indefinite test hangs.
|
r: @lostluck |
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 race condition in the Prism runner's ElementManager that occasionally caused pipeline termination to hang. By ensuring that condition variable broadcasts are properly synchronized with their associated mutex locks, the change guarantees that wake-up signals are correctly received by the watermark evaluation loop. Additionally, minor adjustments were made to test infrastructure to improve CI stability. 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
|
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
There was a problem hiding this comment.
Code Review
This pull request triggers a Python post-commit test suite, configures the Prism Java ValidatesRunner task to always run by disabling up-to-date caching, and fixes potential lost wake-up signals in the Go SDK's element manager by locking the mutex before calling Broadcast on refreshCond. A review comment suggests simplifying the Go code by removing an unnecessary outer goroutine wrapper around time.AfterFunc since it is already non-blocking.
|
Thanks! |
Ensures 'refreshCond.Broadcast()' is fully synchronized with its mutex lock 'refreshCond.L' during pipeline termination and processing-time timer scheduling ('wakeUpAt').
This avoids race conditions causing lost wake-up signals and indefinite test hangs.
Without this change, we have seen a rare deadline exceed on random tests. The goroutine dump suggests that it is stuck in the watermark evaluation loop while the pending element goroutine has ended.
Example:
https://github.com/apache/beam/actions/runs/26588248130/job/78339963103?pr=38713