Change in vdsm[ovirt-3.5]: profiling: import yappi outside lock

fromani at redhat.com fromani at redhat.com
Tue Feb 16 10:40:22 UTC 2016


Hello Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/47591

to review the following change.

Change subject: profiling: import yappi outside lock
......................................................................

profiling: import yappi outside lock

Importing modules with locks held is dangerous and
may lead to deadlock.
Better to move the import of the yappi module outside the lock.

Change-Id: I31d69a70efce2348e2b74e5d8a20e81b2c598321
Signed-off-by: Francesco Romani <fromani at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/37915
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M lib/vdsm/profiling/cpu.py
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/47591/2

diff --git a/lib/vdsm/profiling/cpu.py b/lib/vdsm/profiling/cpu.py
index 93dfacc..ce5b546 100644
--- a/lib/vdsm/profiling/cpu.py
+++ b/lib/vdsm/profiling/cpu.py
@@ -92,8 +92,10 @@
 def _start_profiling(clock, builtins, threads):
     global yappi
     logging.debug("Starting profiling")
+
+    import yappi
+
     with _lock:
-        import yappi
         # yappi start semantics are a bit too liberal, returning success if
         # yappi is already started, happily having too different code paths
         # that thinks they own the single process profiler.


-- 
To view, visit https://gerrit.ovirt.org/47591
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31d69a70efce2348e2b74e5d8a20e81b2c598321
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the vdsm-patches mailing list