Skip to content

Commit

Permalink
Merge PR #33569 into nautilus
Browse files Browse the repository at this point in the history
* refs/pull/33569/head:
	mgr/volumes: unregister job upon async threads exception

Reviewed-by: Ramana Raja <rraja@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
  • Loading branch information
batrick committed Feb 27, 2020
2 parents d7e0d07 + f071465 commit 2885574
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pybind/mgr/volumes/fs/async_job.py
Expand Up @@ -28,6 +28,7 @@ def run(self):
thread_name = thread_id.getName()

while retries < JobThread.MAX_RETRIES_ON_EXCEPTION:
vol_job = None
try:
# fetch next job to execute
with self.async_job.lock:
Expand All @@ -40,10 +41,6 @@ def run(self):

# execute the job (outside lock)
self.async_job.execute_job(vol_job[0], vol_job[1], should_cancel=lambda: thread_id.should_cancel())

# when done, unregister the job
with self.async_job.lock:
self.async_job.unregister_async_job(vol_job[0], vol_job[1], thread_id)
retries = 0
except NotImplementedException:
raise
Expand All @@ -56,7 +53,12 @@ def run(self):
exc_type, exc_value, exc_traceback = sys.exc_info()
log.warning("traceback: {0}".format("".join(
traceback.format_exception(exc_type, exc_value, exc_traceback))))
time.sleep(1)
finally:
# when done, unregister the job
if vol_job:
with self.async_job.lock:
self.async_job.unregister_async_job(vol_job[0], vol_job[1], thread_id)
time.sleep(1)
log.error("thread [{0}] reached exception limit, bailing out...".format(thread_name))
self.vc.cluster_log("thread {0} bailing out due to exception".format(thread_name))

Expand Down

0 comments on commit 2885574

Please sign in to comment.