From: Dan Mick Date: Wed, 10 Dec 2014 21:19:16 +0000 (-0800) Subject: rados.py: remove Rados.__del__(); it just causes problems X-Git-Tag: v0.87.1~11^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ed8c9af3376aeb6f245cbab694fdbc0ce95634a8;p=ceph.git rados.py: remove Rados.__del__(); it just causes problems Recent versions of Python contain a change to thread shutdown that causes ceph to hang on exit; see http://bugs.python.org/issue21963. As it turns out, this is relatively easy to avoid by not spawning threads on exit, as Rados.__del__() will certainly do by calling shutdown(); I suspect, but haven't proven, that the problem is that shutdown() tries to start() a threading.Thread() that never makes it all the way back to signal start(). Also add a PendingReleaseNote and extra doc comments to clarify. Fixes: #8797 Signed-off-by: Dan Mick (cherry picked from commit 5ba9b8f21f8010c59dd84a0ef2acfec99e4b048f) Conflicts: PendingReleaseNotes --- diff --git a/src/pybind/rados.py b/src/pybind/rados.py index 93e5040873e8..3ab6bfe847d3 100644 --- a/src/pybind/rados.py +++ b/src/pybind/rados.py @@ -245,7 +245,8 @@ Rados object in state %s." % (self.state)) def shutdown(self): """ - Disconnects from the cluster. + Disconnects from the cluster. Call this explicitly when a + Rados.connect()ed object is no longer used. """ if (self.__dict__.has_key("state") and self.state != "shutdown"): run_in_thread(self.librados.rados_shutdown, (self.cluster,)) @@ -259,9 +260,6 @@ Rados object in state %s." % (self.state)) self.shutdown() return False - def __del__(self): - self.shutdown() - def version(self): """ Get the version number of the ``librados`` C library. @@ -409,7 +407,7 @@ Rados object in state %s." % (self.state)) def connect(self, timeout=0): """ - Connect to the cluster. + Connect to the cluster. Use shutdown() to release resources. """ self.require_state("configuring") ret = run_in_thread(self.librados.rados_connect, (self.cluster,),