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>
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)