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 15:32:13 +0000
commit7642ae25561531ab41bdc02dfa0f7526ba0d2575 (patch)
tree41622f51b3b30232d5880996df959fc72e5c6989
parentbdbc5ad6f4b16f0921d9eb4c7a1fdeeb17514b9b (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> (cherry picked from commit 6d800137f9756f94b3d3749faf007564c9713dee)
-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()