Skip to content

Commit 059915d

Browse files
committed
distsql: cancel remote flows on quiesce
We recently saw a test timeout where the cluster shutdown was blocked on the outbox goroutine attempting to set up a connection to one of the nodes. We blocked there indefinitely since the remote flows previously didn't respect quiesce signal (we're using the background context there because the remote flows outlive the SetupFlow RPC handler context). This is now fixed. The bug has been present since forever, and given that we haven't hit this before, it seems like an extreme edge case, so I decided to omit the release note. Release note: None
1 parent 3b941f6 commit 059915d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/sql/distsql/server.go

+4
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,10 @@ func (ds *ServerImpl) SetupFlow(
620620
// Note: the passed context will be canceled when this RPC completes, so we
621621
// can't associate it with the flow since it outlives the RPC.
622622
ctx = ds.AnnotateCtx(context.Background())
623+
// Ensure that the flow respects the node being shut down. Note that since
624+
// the flow outlives the RPC, we cannot defer the cancel function, so we
625+
// simply ignore it.
626+
ctx, _ = ds.Stopper.WithCancelOnQuiesce(ctx)
623627
if err := func() error {
624628
// Reserve some memory for this remote flow which is a poor man's
625629
// admission control based on the RAM usage.

0 commit comments

Comments
 (0)