From fa82aeb1e9523a6d5652b1f1cfeb2cba18ba190c Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 9 Feb 2012 15:07:51 -0500 Subject: [PATCH] Don't tell Qpid to reconnect in a busy loop. Fix bug 929784. Don't set any of the reconnect timing options unless they have been set in the configuration. Setting them all to zero puts Qpid in a mode where it will reconnect in a busy loop. By not setting these unless a non-zero value has been provided, Qpid goes back to its default behavior, which is to use an exponential backoff on reconnect attempts (after 1 second, then 2, 4, 8, etc). Change-Id: Ia587bbe96db9ea6e429af289c3d586f4c6706648 --- nova/rpc/impl_qpid.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/nova/rpc/impl_qpid.py b/nova/rpc/impl_qpid.py index 98f8b06d..2e71d470 100644 --- a/nova/rpc/impl_qpid.py +++ b/nova/rpc/impl_qpid.py @@ -299,13 +299,18 @@ class Connection(object): self.connection.password = params['password'] self.connection.sasl_mechanisms = FLAGS.qpid_sasl_mechanisms self.connection.reconnect = FLAGS.qpid_reconnect - self.connection.reconnect_timeout = FLAGS.qpid_reconnect_timeout - self.connection.reconnect_limit = FLAGS.qpid_reconnect_limit - _qpid_reconnect_interval_max = FLAGS.qpid_reconnect_interval_max - self.connection.reconnect_interval_max = _qpid_reconnect_interval_max - _qpid_reconnect_interval_min = FLAGS.qpid_reconnect_interval_min - self.connection.reconnect_interval_min = _qpid_reconnect_interval_min - self.connection.reconnect_interval = FLAGS.qpid_reconnect_interval + if FLAGS.qpid_reconnect_timeout: + self.connection.reconnect_timeout = FLAGS.qpid_reconnect_timeout + if FLAGS.qpid_reconnect_limit: + self.connection.reconnect_limit = FLAGS.qpid_reconnect_limit + if FLAGS.qpid_reconnect_interval_max: + self.connection.reconnect_interval_max = ( + FLAGS.qpid_reconnect_interval_max) + if FLAGS.qpid_reconnect_interval_min: + self.connection.reconnect_interval_min = ( + FLAGS.qpid_reconnect_interval_min) + if FLAGS.qpid_reconnect_interval: + self.connection.reconnect_interval = FLAGS.qpid_reconnect_interval self.connection.hearbeat = FLAGS.qpid_heartbeat self.connection.protocol = FLAGS.qpid_protocol self.connection.tcp_nodelay = FLAGS.qpid_tcp_nodelay