We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ccb6061 commit a4987e8Copy full SHA for a4987e8
xds/internal/xdsclient/client_refcounted.go
@@ -40,19 +40,24 @@ var (
40
41
func clientRefCountedClose(name string) {
42
clientsMu.Lock()
43
- defer clientsMu.Unlock()
44
-
45
client, ok := clients[name]
46
if !ok {
47
logger.Errorf("Attempt to close a non-existent xDS client with name %s", name)
+ clientsMu.Unlock()
48
return
49
}
50
if client.decrRef() != 0 {
51
52
53
+ delete(clients, name)
54
55
+
56
+ // This attempts to close the transport to the management server and could
57
+ // theoretically call back into the xdsclient package again and deadlock.
58
+ // Hence, this needs to be called without holding the lock.
59
client.clientImpl.close()
60
xdsClientImplCloseHook(name)
- delete(clients, name)
61
62
63
0 commit comments