runtime: wake select receivers for unbuffered sends#1691
runtime: wake select receivers for unbuffered sends#1691cpunion wants to merge 4 commits intogoplus:mainfrom
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 where select-based receivers might not be woken up when an unbuffered channel sender becomes blocked. The fix involves explicitly notifying select operations (notifyOps) when an unbuffered send enters a blocked state, ensuring that waiting receivers can correctly process the pending send. A new regression test has been added to prevent future regressions of this specific scenario. Highlights
🧠 New Feature in Public Preview: You can now enable Memory 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. Changelog
Activity
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 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 counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Clean, well-targeted fix for a real race condition. The placement of |
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where select receivers were not being woken up for unbuffered sends. The fix in runtime/internal/runtime/z_chan.go correctly notifies select operations when an unbuffered sender is about to block, which seems appropriate. The new regression test in test/select_test.go effectively covers the scenario. I've identified a minor issue in the test where a goroutine could leak in case of a timeout and have provided a suggestion to make the test more robust.
Note: Security Review did not run due to the size of the PR.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1691 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 48 48
Lines 13314 13314
=======================================
Hits 12404 12404
Misses 724 724
Partials 186 186 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #694.
Summary
selecton an unbuffered receive while another goroutine starts a blocking sendValidation
go test ./test -run TestSelectRecvWakesForBlockedUnbufferedSend -count=1/tmp/llgo-694 test ./test -run TestSelectRecvWakesForBlockedUnbufferedSend -count=1/tmp/llgo-694 run ./cl/_testgo/select/tmp/llgo-694 run ./cl/_testgo/selectsgo test ./test -count=1/tmp/llgo-694 test ./test -count=1