Fix rhbz#1155335 -- /usr/bin/ceph hangs indefinitely

This commit is contained in:
Boris Ranto 2015-01-14 08:35:02 +01:00
parent 615188d81c
commit 8e6771dba7
3 changed files with 102 additions and 3 deletions

View File

@ -0,0 +1,31 @@
From 11995b329045341c17553269267cfd3688a51b0f Mon Sep 17 00:00:00 2001
From: Dan Mick <dan.mick@redhat.com>
Date: Wed, 10 Dec 2014 13:19:53 -0800
Subject: [PATCH 2/2] Call Rados.shutdown() explicitly before exit
This is mostly a demonstration of good behavior, as the resources will
be reclaimed on exit anyway.
Signed-off-by: Dan Mick <dan.mick@redhat.com>
(cherry picked from commit b038e8fbf9103cc42a4cde734b3ee601af6019ea)
---
src/ceph.in | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/ceph.in b/src/ceph.in
index 82c9085..c5b97ef 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -841,4 +841,8 @@ def main():
return 0
if __name__ == '__main__':
- sys.exit(main())
+ retval = main()
+ # shutdown explicitly; Rados() does not
+ if cluster_handle:
+ cluster_handle.shutdown()
+ sys.exit(retval)
--
1.9.3

View File

@ -0,0 +1,61 @@
From e00270b51896f168d5013b7dc92ec7f8b9e19da3 Mon Sep 17 00:00:00 2001
From: Dan Mick <dan.mick@redhat.com>
Date: Wed, 10 Dec 2014 13:19:16 -0800
Subject: [PATCH 1/2] 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 <dan.mick@redhat.com>
(cherry picked from commit 5ba9b8f21f8010c59dd84a0ef2acfec99e4b048f)
Conflicts:
PendingReleaseNotes
---
src/pybind/rados.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/pybind/rados.py b/src/pybind/rados.py
index 0fbd10e..ec68919 100644
--- a/src/pybind/rados.py
+++ b/src/pybind/rados.py
@@ -246,7 +246,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,))
@@ -260,9 +261,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.
@@ -410,7 +408,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,),
--
1.9.3

View File

@ -10,7 +10,7 @@
#################################################################################
Name: ceph
Version: 0.80.7
Release: 2%{?dist}
Release: 3%{?dist}
Epoch: 1
Summary: User space components of the Ceph file system
License: GPLv2
@ -20,6 +20,8 @@ Source0: http://ceph.com/download/%{name}-%{version}.tar.bz2
Patch0: ceph-google-gperftools.patch
Patch1: ceph-no-format-security.patch
Patch2: ceph-common-do-not-unlock-rwlock-on-destruction.patch
Patch3: ceph-remove-rados-py-destructor.patch
Patch4: ceph-call-rados-shutdown-explicitly.patch
Requires: librbd1 = %{epoch}:%{version}-%{release}
Requires: librados2 = %{epoch}:%{version}-%{release}
Requires: libcephfs1 = %{epoch}:%{version}-%{release}
@ -392,6 +394,8 @@ python-cephfs instead.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
# Find jni.h
@ -879,10 +883,13 @@ ln -sf %{_libdir}/librbd.so.1 /usr/lib64/qemu/librbd.so.1
%files -n python-ceph-compat
%changelog
* Mon Dec 8 2014 Boris Ranto <branto@redhat.com - 1:0.80.7-2
* Wed Jan 14 2015 Boris Ranto <branto@redhat.com> - 1:0.80.7-3
- Fix rhbz#1155335 -- /usr/bin/ceph hangs indefinitely
* Mon Dec 8 2014 Boris Ranto <branto@redhat.com> - 1:0.80.7-2
- Fix rhbz#1144794
* Thu Oct 16 2014 Boris Ranto <branto@redhat.com - 1:0.80.7-1
* Thu Oct 16 2014 Boris Ranto <branto@redhat.com> - 1:0.80.7-1
- Rebase to latest upstream version
* Sat Oct 11 2014 Boris Ranto <branto@redhat.com> - 1:0.80.6-3