OpenStack library for messaging
Go to file
John Eckersberg d57eccd862 amqp1: fix race when reconnecting
Currently this is how reconnect works:

- pyngus detects failure and invokes callback
  Controller.connection_failed() which in turn calls
  Controller._handle_connection_loss()

- The first thing that _handle_connection_loss does is to set
  self.addresser to None (important later)

- Then it defers _do_reconnect after a delay (normally 1 second)

- (1 second passes)

- _do_reconnect calls _hard_reset which resets the controller state

However, there is a race here.  This can happen:

- The above, up until it defers and waits for 1 second

- Controller.send() is invoked on a task

- A new Sender is created, and critically because self.reply_link
  still exists and is active, we call sender.attach and pass in
  self.addresser.  Remember _handle_connection_loss sets
  self.addresser to None.

- Eventually Sender.attach throws an AttributeError because it
  attempts to call addresser.resolve() but addresser is None

The reason this happens is because although the connection is dead,
the controller state is still half-alive because _hard_reset hasn't
been called yet since it's deferred one second in _do_reconnect.

The fix here is to move _hard_reset out of _do_reconnect and directly
into _handle_connection_loss.  The eventloop is woken up immediately
to process _hard_reset but _do_reconnect is still deferred as before
so as to retain the desired reconnect backoff behavior.

Closes-Bug: #1941652
Change-Id: Ife62a7d76022908f0dc6a77f1ad607cb2fbd3e8f
(cherry picked from commit 02a38f507d)
2021-12-15 10:25:42 +00:00
doc Correctly handle missing RabbitMQ queues 2021-02-04 09:47:08 +00:00
etc Fix spelling typo in output 2015-09-24 18:11:22 +08:00
oslo_messaging amqp1: fix race when reconnecting 2021-12-15 10:25:42 +00:00
releasenotes Add Support For oslo.metrics 2021-06-08 22:22:37 +08:00
tools Adding pre-commit 2020-09-22 12:35:37 +02:00
.coveragerc Update .coveragerc after the removal of respective directory 2016-10-18 17:20:09 +05:30
.gitignore Ignore releasenote cache within git untracked files 2019-12-18 17:03:10 +01:00
.gitreview Update .gitreview for stable/xena 2021-09-10 14:35:04 +00:00
.pre-commit-config.yaml Upgrade the pre-commit-hooks version 2021-05-18 11:14:35 +08:00
.stestr.conf Switch to stestr 2018-07-04 08:33:49 +07:00
.zuul.yaml Add Python3 xena unit tests 2021-03-18 11:20:42 +00:00
CONTRIBUTING.rst Align contributing doc with oslo's policy 2020-05-04 18:25:31 +02:00
HACKING.rst Update URLs in documents according to document migration 2017-07-12 22:54:02 +08:00
LICENSE Add oslo.messaging project infrastructure 2013-06-15 08:43:50 +01:00
README.rst Replace git.openstack.org URLs with opendev.org URLs 2019-04-26 10:31:26 +08:00
babel.cfg Setup for translation 2014-06-05 22:48:44 +02:00
bindep.txt Merge "bindep: Add 'librdkafka-dev' dependency" 2021-04-16 13:11:15 +00:00
requirements.txt Add Support For oslo.metrics 2021-06-08 22:22:37 +08:00
setup.cfg setup.cfg: Replace dashes with underscores 2021-05-13 20:29:03 +08:00
setup.py remove outdated header 2020-02-10 18:33:15 +01:00
test-requirements.txt Adding pre-commit 2020-09-22 12:35:37 +02:00
tox.ini Update TOX_CONSTRAINTS_FILE for stable/xena 2021-09-10 14:35:05 +00:00

README.rst

Team and repository tags

image

Oslo Messaging Library

Latest Version

Downloads

The Oslo messaging API supports RPC and notifications over a number of different messaging transports.