]> git.feebdaed.xyz Git - 0xmirror/grpc-go.git/commit
gracefulswitch: Wait for all goroutines on close (#8746)
authorTom Wieczorek <twz123@users.noreply.github.com>
Thu, 11 Dec 2025 06:06:34 +0000 (07:06 +0100)
committerGitHub <noreply@github.com>
Thu, 11 Dec 2025 06:06:34 +0000 (11:36 +0530)
commit9b990b6355c443ecf9e71f118f7097b62bc3299a
tree8f9367a565db54dc906ec78b0aa11ffee46faad4
parent6677d9a9cf1dd8227673253015027de0addeeafb
gracefulswitch: Wait for all goroutines on close (#8746)

Goroutines spawned during balancer swaps could outlive the call to
Balancer.Close(). Monitor these via a wait group and wait for them to
finish before returning from Close(). This prevents any noticeable side
effects that could otherwise occur after Close() returns.

See:

* #8655
* https://github.com/grpc/grpc-go/pull/8666#issuecomment-3604119490

RELEASE NOTES:
- client: Closing a graceful switch balancer will now block until all
pending goroutines complete.

Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
internal/balancer/gracefulswitch/gracefulswitch.go