Skip to content

Commit 80dac1c

Browse files
committed
xds/xdsdepmgr: drop watcher and xdsClient references on Close
Per easwars' review: nil out m.watcher and m.xdsClient at the end of DependencyManager.Close so the manager doesn't retain the resolver (ConfigWatcher) or the xDS client after shutdown. Every callback that touches those fields already re-checks m.stopped under m.mu, so the nil assignments are safe once m.stopped is set.
1 parent efecd06 commit 80dac1c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

internal/xds/xdsdepmgr/xds_dependency_manager.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ func (m *DependencyManager) Close() {
203203
dnsResolver.stop()
204204
delete(m.dnsResolvers, name)
205205
}
206+
207+
// Drop references to externally-owned collaborators so the dependency
208+
// manager itself doesn't retain them once Close returns. All in-flight
209+
// callbacks re-check m.stopped under m.mu before touching these fields.
210+
m.watcher = nil
211+
m.xdsClient = nil
206212
}
207213

208214
// annotateErrorWithNodeID annotates the given error with the provided xDS node

0 commit comments

Comments
 (0)