]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rados.py: remove Rados.__del__(); it just causes problems
authorDan Mick <dan.mick@redhat.com>
Wed, 10 Dec 2014 21:19:16 +0000 (13:19 -0800)
committerDan Mick <dan.mick@redhat.com>
Wed, 10 Dec 2014 21:19:16 +0000 (13:19 -0800)
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 <dan.mick@redhat.com>
PendingReleaseNotes
src/pybind/rados.py

index 67f1628a7e94c0c16be5e1a3d4ecaab6f147b75a..62b79204964a1f9a90400470d3033fa2e9334bd8 100644 (file)
@@ -28,3 +28,8 @@ v0.90
 
 * The 'rados create <objectname> [category]' optional category argument is no
   longer supported or recognized.
+
+* rados.py's Rados class no longer has a __del__ method; it was causing
+  problems on interpreter shutdown and use of threads.  If your code has
+  Rados objects with limited lifetimes and you're concerned about locked
+  resources, call Rados.shutdown() explicitly.
index 82521cacb8e6eb32339da0200fd517323d8ebc39..d6cfe2f07e49235df1bb0f566982904c51b711f4 100644 (file)
@@ -259,7 +259,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,))
@@ -273,9 +274,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.
@@ -424,7 +422,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,),