]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/client: validate connection before sending
authorNitzan Mordechai <nmordech@redhat.com>
Mon, 15 Jul 2024 10:02:04 +0000 (10:02 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Sun, 28 Jul 2024 08:22:23 +0000 (11:22 +0300)
During the connection's lifecycle, it can be reset and set to
nullptr by other functions.
We need to verify that the connection is still available before
attempting to send data.

Fixes: https://tracker.ceph.com/issues/62162
Signed-off-by: NitzanMordhai <nmordech@redhat.com>
(cherry picked from commit 49c9dad15e5d5c182a88c1d9e21707bd1f8ccaba)

src/crimson/mgr/client.cc

index d2a1ea5136a008c5a88900cfe9a5d0facc2885a9..69a69bfddf55317d14dd07b3115b872bca664326 100644 (file)
@@ -165,6 +165,10 @@ void Client::report()
     }
     return with_stats.get_stats(
     ).then([this](auto &&pg_stats) {
+      if (!conn) {
+        logger().warn("report: no conn available; before sending stats, report skipped");
+        return seastar::now();
+      }
       return conn->send(std::move(pg_stats));
     });
   });