From b2442d42a39b35eef8b316b80bc6e169bc840df8 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Tue, 22 Jan 2019 08:40:26 -0500 Subject: [PATCH] detect dead DB connections in the dispatcher when reaping jobs --- awx/main/dispatch/pool.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/awx/main/dispatch/pool.py b/awx/main/dispatch/pool.py index 391809097d..d0dc46a2ff 100644 --- a/awx/main/dispatch/pool.py +++ b/awx/main/dispatch/pool.py @@ -373,6 +373,10 @@ class AutoscalePool(WorkerPool): # don't use our logger (it accesses the database for configuration) _, _, tb = sys.exc_info() traceback.print_tb(tb) + for conn in connections.all(): + # If the database connection has a hiccup, re-establish a new + # connection + conn.close_if_unusable_or_obsolete() def up(self): if self.full: