]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: only shut down rados on clean exit
authorSage Weil <sage@redhat.com>
Mon, 9 Mar 2020 17:26:06 +0000 (12:26 -0500)
committerSage Weil <sage@redhat.com>
Mon, 9 Mar 2020 17:26:58 +0000 (12:26 -0500)
If we exit due to a timeout, then calling rados shutdown can lead to all
sorts of problems, because we may still have another thread that is
trying to call rados_connect and/or do some work, and rados_connect
and rados_shutdown don't (and can't!) really behave well when racing
against each other.

Note that shutdown here isn't that important--the process is about to
exit anyway.  It's only useful to exercise the shutdown code path more
often.

Fixes: https://tracker.ceph.com/issues/44526
Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph.in

index 34b6c468b73ea89da468e5daa18b61ebfc85aada..9ff04ea3a40c80aedc02ca3508af318c43fe8901 100755 (executable)
@@ -1273,11 +1273,10 @@ def main():
 if __name__ == '__main__':
     try:
         retval = main()
+        # shutdown explicitly; Rados() does not
+        if retval == 0 and cluster_handle:
+            run_in_thread(cluster_handle.shutdown)
     except KeyboardInterrupt:
         print('Interrupted')
         retval = errno.EINTR
-    finally:
-        # shutdown explicitly; Rados() does not
-        if cluster_handle:
-            run_in_thread(cluster_handle.shutdown)
     sys.exit(retval)