mirror of
https://github.com/lukaszraczylo/kubemirror.git
synced 2026-06-06 22:49:23 +00:00
cf095e93f4
H2: scanAndRegister held d.mu (write lock) across registerController and registerMirrorControllerOnly. Those calls enter controller-runtime's manager state machine, which takes its own internal locks and can block on cache sync — holding our application-level write lock across them is a latent deadlock the moment any reentrant access happens (health checks reading GetRegisteredCount, factories that introspect state). Restructured into three phases: snapshot work under RLock, perform registrations with NO lock held, then commit results under Lock. Registration step routed through funcs to keep tests honest about the lock state at the moment of invocation.