File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -40,19 +40,24 @@ var (
40
40
41
41
func clientRefCountedClose (name string ) {
42
42
clientsMu .Lock ()
43
- defer clientsMu .Unlock ()
44
-
45
43
client , ok := clients [name ]
46
44
if ! ok {
47
45
logger .Errorf ("Attempt to close a non-existent xDS client with name %s" , name )
46
+ clientsMu .Unlock ()
48
47
return
49
48
}
50
49
if client .decrRef () != 0 {
50
+ clientsMu .Unlock ()
51
51
return
52
52
}
53
+ delete (clients , name )
54
+ clientsMu .Unlock ()
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.
53
59
client .clientImpl .close ()
54
60
xdsClientImplCloseHook (name )
55
- delete (clients , name )
56
61
57
62
}
58
63
You can’t perform that action at this time.
0 commit comments