]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/DaemonServer: erase daemon_connections ref on reset for all peer types
authorSunnatillo <sunnat.samadov@est.tech>
Tue, 21 Jul 2026 08:26:02 +0000 (11:26 +0300)
committerSunnatillo <sunnat.samadov@est.tech>
Tue, 21 Jul 2026 08:27:49 +0000 (11:27 +0300)
handle_open() stores a strong ConnectionRef in daemon_connections for
every non-client daemon (mon, mds, osd), but ms_handle_reset() erased
it only for OSD peers.

Any non-OSD daemon connection that ended without an explicit MMgrClose
(idle timeout, network drop, daemon crash) left a permanent
ConnectionRef behind. That leaked one AsyncConnection per reconnect
cycle and caused unbounded ceph-mgr RSS growth.

Erase daemon_connections unconditionally on reset while keeping
osd_cons cleanup under the OSD peer-type guard.

Fixes: https://tracker.ceph.com/issues/78408
Signed-off-by: Sunnatillo <sunnat.samadov@est.tech>
src/mgr/DaemonServer.cc

index 822b508cbd90f30b2cf72d6c710f673773559a92..69d4fb0c44126a68d9562eb02c9bd31100d9e48a 100644 (file)
@@ -331,21 +331,20 @@ void DaemonServer::ms_handle_accept(Connection* con)
 
 bool DaemonServer::ms_handle_reset(Connection *con)
 {
+  std::lock_guard l(lock);
   if (con->get_peer_type() == CEPH_ENTITY_TYPE_OSD) {
     auto priv = con->get_priv();
     auto session = static_cast<MgrSession*>(priv.get());
-    if (!session) {
-      return false;
+    if (session) {
+      dout(10) << "unregistering osd." << session->osd_id
+               << "  session " << session << " con " << con << dendl;
+      osd_cons[session->osd_id].erase(con);
     }
-    std::lock_guard l(lock);
-    dout(10) << "unregistering osd." << session->osd_id
-            << "  session " << session << " con " << con << dendl;
-    osd_cons[session->osd_id].erase(con);
+  }
 
-    auto iter = daemon_connections.find(con);
-    if (iter != daemon_connections.end()) {
-      daemon_connections.erase(iter);
-    }
+  auto iter = daemon_connections.find(con);
+  if (iter != daemon_connections.end()) {
+    daemon_connections.erase(iter);
   }
   return false;
 }