From 6d800137f9756f94b3d3749faf007564c9713dee Mon Sep 17 00:00:00 2001 From: Mark Beierl Date: Wed, 9 Mar 2016 10:27:35 -0500 Subject: 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 --- storperf/db/job_db.py | 11 +++++++---- 1 file 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() -- cgit 1.2.3-korg