Merge pull request #106892 from ncdc/improve-path-recorder-duplicate-registration-info

Improve pathrecorder duplicate registration info
This commit is contained in:
Kubernetes Prow Robot 2021-12-09 08:06:28 -08:00 committed by GitHub
commit bfeabe894f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,10 +103,11 @@ func (m *PathRecorderMux) ListedPaths() []string {
}
func (m *PathRecorderMux) trackCallers(path string) {
stack := string(debug.Stack())
if existingStack, ok := m.pathStacks[path]; ok {
utilruntime.HandleError(fmt.Errorf("registered %q from %v", path, existingStack))
utilruntime.HandleError(fmt.Errorf("duplicate path registration of %q: original registration from %v\n\nnew registration from %v", path, existingStack, stack))
}
m.pathStacks[path] = string(debug.Stack())
m.pathStacks[path] = stack
}
// refreshMuxLocked creates a new mux and must be called while locked. Otherwise the view of handlers may