]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/test: stop the messenger-thrash config on every exit path 69794/head
authorKefu Chai <k.chai@proxmox.com>
Mon, 29 Jun 2026 01:19:02 +0000 (09:19 +0800)
committerKefu Chai <k.chai@proxmox.com>
Mon, 29 Jun 2026 01:22:45 +0000 (09:22 +0800)
test_messenger_thrash put sharded_conf().stop() in the success
continuation, so an exception from the tests skipped it and left the
static sharded<ConfigProxy> holding live instances. its destructor then
asserts. a tester hit this when the run went OOM at --memory 256M:

  ERROR [shard 0:main] test - Test failed: got exception
    ceph::buffer::v15_2_0::bad_alloc (Bad allocation [buffer:1])
  /ceph/src/seastar/include/seastar/core/sharded.hh:573:
    seastar::sharded<Service>::~sharded()
    [with Service = crimson::common::ConfigProxy]:
    Assertion `_instances.empty()' failed.
  terminate called without an active exception

run the body in seastar::async and stop the config through
seastar::deferred_stop, as crimson/osd/main.cc already does. the guard
is constructed only after start() succeeds, and its destructor stops the
config on any exit path, so a failing test exits cleanly instead of
aborting.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/test/crimson/test_messenger_thrash.cc

index ebc4a383ab287646a6192ebe0aa6272849745b0f..36af35739ce971d1323400893db4eae88190d3d4 100644 (file)
@@ -10,7 +10,9 @@
 #include <seastar/core/future-util.hh>
 #include <seastar/core/reactor.hh>
 #include <seastar/core/sleep.hh>
+#include <seastar/core/thread.hh>
 #include <seastar/core/with_timeout.hh>
+#include <seastar/util/closeable.hh>
 
 #include "common/ceph_argparse.h"
 #include "messages/MPing.h"
@@ -636,31 +638,24 @@ seastar::future<int> do_test(seastar::app_template& app)
                                               CEPH_ENTITY_TYPE_CLIENT,
                                               &cluster,
                                               &conf_file_list);
-  return crimson::common::sharded_conf().start(
-    init_params.name, cluster
-  ).then([] {
-    return local_conf().start();
-  }).then([conf_file_list] {
-    return local_conf().parse_config_files(conf_file_list);
-  }).then([&app] {
-    auto&& config = app.configuration();
-    verbose = config["verbose"].as<bool>();
-      return test_stress(thrash_params_t{8, 32, 50, 120})
-    .then([] {
-      return test_injection(thrash_params_t{16, 32, 50, 120});
-    }).then([] {
+  return seastar::async([init_params, cluster, conf_file_list, &app] {
+    try {
+      crimson::common::sharded_conf().start(init_params.name, cluster).get();
+      local_conf().start().get();
+      auto stop_conf = seastar::deferred_stop(crimson::common::sharded_conf());
+      local_conf().parse_config_files(conf_file_list).get();
+      verbose = app.configuration()["verbose"].as<bool>();
+      test_stress(thrash_params_t{8, 32, 50, 120}).get();
+      test_injection(thrash_params_t{16, 32, 50, 120}).get();
       logger().info("All tests succeeded");
       // Seastar has bugs to have events undispatched during shutdown,
       // which will result in memory leak and thus fail LeakSanitizer.
-      return seastar::sleep(100ms);
-    });
-  }).then([] {
-    return crimson::common::sharded_conf().stop();
-  }).then([] {
-    return 0;
-  }).handle_exception([] (auto eptr) {
-    logger().error("Test failed: got exception {}", eptr);
-    return 1;
+      seastar::sleep(100ms).get();
+      return 0;
+    } catch (...) {
+      logger().error("Test failed: got exception {}", std::current_exception());
+      return 1;
+    }
   });
 }