Repository navigation
fix(pipeline): replace busy-wait polling with channel-based notification - #24269
Merged
Merged
Conversation
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
Replace the runtime.Gosched() busy-wait loop in GetProcByUuid with a channel-based notification mechanism. PutProcIntoUuidMap now broadcasts to waiters via a close-and-swap channel pattern, and GetProcByUuidOrWait atomically returns a wait channel on lookup miss to avoid TOCTOU races. Also removes the arbitrary 3600s HandleNotifyTimeout and waitNotifyTimeout constants — query/connection context cancellation is the natural lifetime bound. Fixes NewServer init race with CompareAndSwap, and provides a meaningful cancellation cause when remote connection drops. Co-Authored-By: Claude Opus 4.6 <[email protected]>
aunjgr
force-pushed
the
fix/remoterun-busy-wait
branch
from
May 3, 2026 16:53
7b1d32c to
5926be2
Compare
ouyuanning
approved these changes
May 5, 2026
Contributor
Merge Queue Status
This pull request spent 14 seconds in the queue, including 2 seconds running CI. Required conditions to merge
|
fengttt
pushed a commit
to fengttt/matrixone
that referenced
this pull request
May 7, 2026
…ion (matrixorigin#24269) Replaces the `runtime.Gosched()` busy-wait polling loop in `remoterunServer.GetProcByUuid` with a proper channel-based notification mechanism. **Changes:** - `UuidProcMap` gains a `changed chan struct{}` that is closed-and-swapped on every `PutProcIntoUuidMap` call, broadcasting to all waiters - New `GetProcByUuidOrWait` method atomically returns a wait channel on lookup miss, eliminating the TOCTOU race between lookup and wait - Removes `HandleNotifyTimeout` (3600s) from `remoterunServer.go` — the connection/query context is the natural lifetime bound - Removes `waitNotifyTimeout` (3600s) from `dispatch/types.go` — `proc.Ctx` already bounds `waitRemoteRegsReady` - Fixes `NewServer` init race with `CompareAndSwap` instead of check-then-set - Provides a meaningful cancellation cause (`"remote receiver connection closed"`) instead of nil when connection drops Approved by: @ouyuanning
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
…ion (matrixorigin#24269) Replaces the `runtime.Gosched()` busy-wait polling loop in `remoterunServer.GetProcByUuid` with a proper channel-based notification mechanism. **Changes:** - `UuidProcMap` gains a `changed chan struct{}` that is closed-and-swapped on every `PutProcIntoUuidMap` call, broadcasting to all waiters - New `GetProcByUuidOrWait` method atomically returns a wait channel on lookup miss, eliminating the TOCTOU race between lookup and wait - Removes `HandleNotifyTimeout` (3600s) from `remoterunServer.go` — the connection/query context is the natural lifetime bound - Removes `waitNotifyTimeout` (3600s) from `dispatch/types.go` — `proc.Ctx` already bounds `waitRemoteRegsReady` - Fixes `NewServer` init race with `CompareAndSwap` instead of check-then-set - Provides a meaningful cancellation cause (`"remote receiver connection closed"`) instead of nil when connection drops Approved by: @ouyuanning
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
…ion (matrixorigin#24269) Replaces the `runtime.Gosched()` busy-wait polling loop in `remoterunServer.GetProcByUuid` with a proper channel-based notification mechanism. **Changes:** - `UuidProcMap` gains a `changed chan struct{}` that is closed-and-swapped on every `PutProcIntoUuidMap` call, broadcasting to all waiters - New `GetProcByUuidOrWait` method atomically returns a wait channel on lookup miss, eliminating the TOCTOU race between lookup and wait - Removes `HandleNotifyTimeout` (3600s) from `remoterunServer.go` — the connection/query context is the natural lifetime bound - Removes `waitNotifyTimeout` (3600s) from `dispatch/types.go` — `proc.Ctx` already bounds `waitRemoteRegsReady` - Fixes `NewServer` init race with `CompareAndSwap` instead of check-then-set - Provides a meaningful cancellation cause (`"remote receiver connection closed"`) instead of nil when connection drops Approved by: @ouyuanning
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #23277
issue #23278
issue #23284
What this PR does / why we need it:
Replaces the
runtime.Gosched()busy-wait polling loop inremoterunServer.GetProcByUuidwith a proper channel-based notification mechanism.Changes:
UuidProcMapgains achanged chan struct{}that is closed-and-swapped on everyPutProcIntoUuidMapcall, broadcasting to all waitersGetProcByUuidOrWaitmethod atomically returns a wait channel on lookup miss, eliminating the TOCTOU race between lookup and waitHandleNotifyTimeout(3600s) fromremoterunServer.go— the connection/query context is the natural lifetime boundwaitNotifyTimeout(3600s) fromdispatch/types.go—proc.Ctxalready boundswaitRemoteRegsReadyNewServerinit race withCompareAndSwapinstead of check-then-set"remote receiver connection closed") instead of nil when connection drops