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. Changes: oslo_messaging/_drivers/impl_rabbit.py NOTE(stephenfin): We need to add the 'absolute_import' future to disable the legacy import flow. Without this, the import of 'amqp.exceptions' in 'oslo_messaging._drivers.impl_rabbit' attempts to import 'exceptions' from the sibling module, 'oslo_messaging._drivers.amqp', instead of the top-level 'amqp' module. Thank God for Python 3.x, eh? More information is available at [1], for those curious enough. NOTE(hberaud): conflicts within the cherry-pick on stable/stein due to removed log translation and i18n on stable/train [2]. I decided to ignore this patch [2] for stable/stein first to prepare cherry-picking on previous stable branches (rocky, queens) and secondly because I don't think we want it on older branches. [1] https://stackoverflow.com/q/33743880/ [2]4f385720d7
Change-Id: I5c468d10230f05438df780e045f1e92662edf070 Closes-Bug: #1883038 (cherry picked from commit26e8bb4cc9
) (cherry picked from commit360deb89a7
) (cherry picked from commit54ced5361b
)
This commit is contained in:
parent
0c47ed4e1b
commit
e05bb37ae2
|
@ -12,6 +12,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import errno
|
import errno
|
||||||
import functools
|
import functools
|
||||||
|
@ -26,6 +28,7 @@ import threading
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from amqp import exceptions as amqp_exec
|
||||||
import kombu
|
import kombu
|
||||||
import kombu.connection
|
import kombu.connection
|
||||||
import kombu.entity
|
import kombu.entity
|
||||||
|
@ -953,7 +956,8 @@ class Connection(object):
|
||||||
except (socket.timeout,
|
except (socket.timeout,
|
||||||
ConnectRefuseError,
|
ConnectRefuseError,
|
||||||
OSError,
|
OSError,
|
||||||
kombu.exceptions.OperationalError) as exc:
|
kombu.exceptions.OperationalError,
|
||||||
|
amqp_exec.ConnectionForced) as exc:
|
||||||
LOG.info(_LI("A recoverable connection/channel error "
|
LOG.info(_LI("A recoverable connection/channel error "
|
||||||
"occurred, trying to reconnect: %s"), exc)
|
"occurred, trying to reconnect: %s"), exc)
|
||||||
self.ensure_connection()
|
self.ensure_connection()
|
||||||
|
|
Loading…
Reference in New Issue