From: Sage Weil Date: Mon, 9 Mar 2020 17:26:06 +0000 (-0500) Subject: ceph.in: only shut down rados on clean exit X-Git-Tag: v15.1.1~53^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c8f353c50bcd2a30be9e3600dba91912b8cd0429;p=ceph.git ceph.in: only shut down rados on clean exit 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 --- diff --git a/src/ceph.in b/src/ceph.in index 34b6c468b73e..9ff04ea3a40c 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -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)