Deadlock in job_db 65/11065/1
authorMark Beierl <mark.beierl@emc.com>
Wed, 9 Mar 2016 15:27:35 +0000 (10:27 -0500)
committerMark Beierl <mark.beierl@emc.com>
Wed, 9 Mar 2016 15:27:45 +0000 (10:27 -0500)
Change order of operation so that we do not attempt
to lock the same mutex twice in a row.

Change-Id: I1f874d720e2b66d9b272be0202482b22d24ef2b2
JIRA: STORPERF-42
Signed-off-by: Mark Beierl <mark.beierl@emc.com>
storperf/db/job_db.py

index f24ccf4..57c82cb 100644 (file)
@@ -80,9 +80,11 @@ class JobDB(object):
         """
         Records the start time for the given workload
         """
+
+        if (self.job_id is None):
+            self.create_job_id()
+
         with db_mutex:
-            if (self.job_id is None):
-                self.create_job_id()
 
             db = sqlite3.connect(JobDB.db_name)
             cursor = db.cursor()
@@ -124,9 +126,10 @@ class JobDB(object):
         """
         Records the end time for the given workload
         """
+        if (self.job_id is None):
+            self.create_job_id()
+
         with db_mutex:
-            if (self.job_id is None):
-                self.create_job_id()
 
             db = sqlite3.connect(JobDB.db_name)
             cursor = db.cursor()