]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: fix unwatch crash at radosgw startup
authorlichaochao <lichaochao2_yewu@cmss.chinamobile.com>
Wed, 27 Sep 2023 10:06:34 +0000 (12:06 +0200)
committerlichaochao <lichaochao2_yewu@cmss.chinamobile.com>
Wed, 27 Sep 2023 10:06:41 +0000 (12:06 +0200)
During radosgw initialization, if there is an exception in init_watch that causes the watcher registration to fail,
When finalize_watch is executed, a crash occurs due to unregister an unregistered watch.

Fixes: https://tracker.ceph.com/issues/60094
Signed-off-by: lichaochao <lichaochao2_yewu@cmss.chinamobile.com>
src/rgw/services/svc_notify.cc

index f43195165179a447c5c4c8dbe2525ec9e41d21d0..43f84ed0a4f7e425383126de64f4f343f823317c 100644 (file)
@@ -253,7 +253,8 @@ void RGWSI_Notify::finalize_watch()
 {
   for (int i = 0; i < num_watchers; i++) {
     RGWWatcher *watcher = watchers[i];
-    watcher->unregister_watch();
+    if (watchers_set.find(i) != watchers_set.end())
+      watcher->unregister_watch();
     delete watcher;
   }