Change in vdsm[master]: misc: Fix possible deadlock when entering sampling method

nsoffer at redhat.com nsoffer at redhat.com
Wed Jun 11 15:47:56 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: misc: Fix possible deadlock when entering sampling method
......................................................................

misc: Fix possible deadlock when entering sampling method

If a thread entered a sampling method and got the lock, it must exit and
release the lock. This code try to ensure this using try finally block.
However, before the try, we log a message about entering the sampling
method. If this log call raises, the lock will never be released,
causing all other threads entering this methods to wait forever.

The possibility of logging failure is very low, but we have seen this in
the field with older Python versions. It is likely that most of the code
is not safe considering such errors, but this particular case it is
trivial to write the code safely.

Change-Id: Ie4b5ce467ed07a3ba787687c7caa9db4c765ef08
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/storage/misc.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/28612/1

diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index c5777b0..016138e 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -735,8 +735,8 @@
         self._log.debug("Trying to enter sampling method (%s.%s)",
                         self.__funcParent, self.__funcName)
         if self.__barrier.enter():
-            self._log.debug("Got in to sampling method")
             try:
+                self._log.debug("Got in to sampling method")
                 self.__lastResult = self.__func(*args, **kwargs)
             finally:
                 self.__barrier.exit()


-- 
To view, visit http://gerrit.ovirt.org/28612
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4b5ce467ed07a3ba787687c7caa9db4c765ef08
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list