summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Beierl <mark.beierl@emc.com>2016-03-09 10:27:35 -0500
committerMark Beierl <mark.beierl@emc.com>2016-03-09 10:27:45 -0500
commit6d800137f9756f94b3d3749faf007564c9713dee (patch)
treef7a30469632df0431fb25705d093ed25d748a1e4
parent56bee3e9541961e5d542d2c008b5420ff44bd185 (diff)
Deadlock in job_db
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>
-rw-r--r--storperf/db/job_db.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/storperf/db/job_db.py b/storperf/db/job_db.py
index f24ccf4..57c82cb 100644
--- a/storperf/db/job_db.py
+++ b/storperf/db/job_db.py
@@ -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()