]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: config option rgw_asio_assert_yielding
authorCasey Bodley <cbodley@redhat.com>
Thu, 20 Jun 2024 19:56:50 +0000 (15:56 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 2 Jul 2024 20:39:39 +0000 (16:39 -0400)
enable this to assert on blocking calls that should be asynchronous
instead of just logging a warning message

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/common/options/rgw.yaml.in
src/rgw/rgw_asio_thread.cc

index 5cb7aee81f1e4c6e7649ef8b10be44bf192a4a01..84e7413cc32701d9e8d8473189754a38e933346c 100644 (file)
@@ -2230,6 +2230,14 @@ options:
   services:
   - rgw
   with_legacy: true
+- name: rgw_asio_assert_yielding
+  type: bool
+  level: dev
+  desc: Trigger an assertion failure if an operation would block an asio thread
+  default: false
+  services:
+  - rgw
+  with_legacy: true
 - name: rgw_user_quota_bucket_sync_interval
   type: int
   level: advanced
index 83a805fb4093d59e39288444af72580f41c49b7e..a1dfd59e528b298152bb36d0d277f5d768dd40a4 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "common/BackTrace.h"
 #include "common/dout.h"
+#include "include/ceph_assert.h"
 
 thread_local bool is_asio_thread = false;
 
@@ -27,6 +28,11 @@ void maybe_warn_about_blocking(const DoutPrefixProvider* dpp)
     return;
   }
 
+  // for validation, tests can assert that no requests block
+  const auto& conf = dpp->get_cct()->_conf;
+  ceph_assert_always(!conf->rgw_asio_assert_yielding);
+
+  // otherwise just log the warning and optional backtrace
   ldpp_dout(dpp, 20) << "WARNING: blocking librados call" << dendl;
 #ifdef _BACKTRACE_LOGGING
   ldpp_dout(dpp, 20) << "BACKTRACE: " << ClibBackTrace(0) << dendl;