Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion xds/internal/xdsclient/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ func (p *Pool) clientRefCountedClose(name string) {
}
delete(p.clients, name)

client.Close()
for _, s := range client.bootstrapConfig.XDSServers() {
Copy link
Contributor

@purnesh42H purnesh42H Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Even these 2 cleanups of authorities and xds servers were being done after releasing the lock before because they were within client's close method. May be we should move them down as well after closing the generic client.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried about actual races here, since the bootstrapConfig appears to be a pointer, and could be modified later.

for _, f := range s.Cleanups() {
f()
Expand All @@ -242,6 +241,11 @@ func (p *Pool) clientRefCountedClose(name string) {
}
p.mu.Unlock()

// This attempts to close the transport to the management server and could
// theoretically call back into the xdsclient package again and deadlock.
// Hence, this needs to be called without holding the lock.
client.Close()

xdsClientImplCloseHook(name)
}

Expand Down