You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
scope.go: missing ctx.Done() in select loop causes goroutine leak on query cancellation #24061
The main coordination loop in scope.go:365-384 is missing a ctx.Done() case in its select statement. When a query is cancelled (e.g., client disconnect), the goroutine blocks forever waiting on preScopeResultReceiveChan and notifyMessageResultReceiveChan.
While the spawned goroutines (via sendNotifyMessage) DO check context cancellation internally through receiveBatch() and forwardRemoteBatchWithContext(), the main loop that waits for their results has no exit path when context is cancelled.
Leak Scenario
Query starts → main loop enters select at line 365
Context cancelled (client disconnects)
Remote receiver goroutines detect cancellation, try to send results to buffered channels
Main loop still blocked on select — no ctx.Done() case
If all buffer slots are full, goroutines block on channel send
Circular deadlock: main loop waits for goroutines, goroutines wait for main loop to drain channels
Activity
fix: 4 CN memory leak/growth issues
fix: 4 CN memory leak/growth issues
fix: CN memory leak/growth issues — 4 fixes with tests
fix: CN memory leak/growth issues — 4 fixes with tests
fix: CN memory leak/growth issues — 4 fixes with tests
fix: 4 CN memory leak/growth issues (#24058 #24059 #24060 #24061) (#2…
fix: 4 CN memory leak/growth issues (matrixorigin#24058 matrixorigin#…