From 360deb89a7e95d332267564b486219e389a793f7 Mon Sep 17 00:00:00 2001 From: shenjiatong Date: Tue, 30 Jun 2020 08:56:26 +0800 Subject: [PATCH] Catch ConnectionForced Exception Occasionally I saw large number of connectionforced exceptions. such exceptions cannot be healed automatically and requires a reboot. catch it and ensure connection established. Change-Id: I5c468d10230f05438df780e045f1e92662edf070 Closes-Bug: #1883038 (cherry picked from commit 26e8bb4cc9097fddf3c2e34599b131e3f5d73867) --- oslo_messaging/_drivers/impl_rabbit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py index 46c5ae04f..d16eb7db4 100644 --- a/oslo_messaging/_drivers/impl_rabbit.py +++ b/oslo_messaging/_drivers/impl_rabbit.py @@ -26,6 +26,7 @@ import threading import time import uuid +from amqp import exceptions as amqp_exec import kombu import kombu.connection import kombu.entity @@ -1012,7 +1013,8 @@ class Connection(object): except (socket.timeout, ConnectRefuseError, OSError, - kombu.exceptions.OperationalError) as exc: + kombu.exceptions.OperationalError, + amqp_exec.ConnectionForced) as exc: LOG.info("A recoverable connection/channel error " "occurred, trying to reconnect: %s", exc) self.ensure_connection()