From 37dbfa88f97cda624d4c594a94eda38a0a86a51d Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 17 Jan 2019 08:18:50 -0500 Subject: [PATCH] close the persistent shelve when we're done checking it this code was added to detect celerybeat shelve .db corruption, but it caused a different issue; opening the shelve in this way puts a write lock on it, which means that when we attempt to open it _again_ moments later, we can't. when we're done checking the validity of the file, we need to close it --- awx/main/management/commands/run_dispatcher.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awx/main/management/commands/run_dispatcher.py b/awx/main/management/commands/run_dispatcher.py index 595abcc9e7..b881c84348 100644 --- a/awx/main/management/commands/run_dispatcher.py +++ b/awx/main/management/commands/run_dispatcher.py @@ -87,6 +87,11 @@ class Command(BaseCommand): except Exception: logger.exception('{} is corrupted, removing.'.format(sched_file)) sched._remove_db() + finally: + try: + sched.close() + except Exception: + logger.exception('{} failed to sync/close'.format(sched_file)) beat.Beat( 30,