Add check credentials to log message if rabbmitmq closes socket

If one has the credentials misconfigured for rabbitmq currently the following
error message is shown: "AMQP server on 10.0.0.23:5672 is unreachable:
Socket closed. Trying again in 1 seconds. " This is confusing because the
problem is the login creditentials are wrong but the server can be reached.

Since the rabbmitmq server allowed the initial connection and closed the
socket it's likely an authenication issue. This patch now logs: "AMQP server
10.0.0.23:5672 closed the connection. Check login credentials: Socket closed"
to hint the user that it could be a credential issue.

Change-Id: Iadff35d88a9cf704c1edd2d5036a113966db3ea3
Closes-bug: 1325750
This commit is contained in:
Aaron Rosen 2014-06-02 14:37:30 -07:00
parent f2cd28e503
commit bf281aace5
1 changed files with 8 additions and 3 deletions

View File

@ -640,9 +640,14 @@ class Connection(object):
sleep_time = min(sleep_time, self.interval_max)
log_info['sleep_time'] = sleep_time
LOG.error(_('AMQP server on %(hostname)s:%(port)d is '
'unreachable: %(err_str)s. Trying again in '
'%(sleep_time)d seconds.') % log_info)
if 'Socket closed' in six.text_type(e):
LOG.error(_('AMQP server %(hostname)s:%(port)d closed'
' the connection. Check login credentials:'
' %(err_str)s') % log_info)
else:
LOG.error(_('AMQP server on %(hostname)s:%(port)d is '
'unreachable: %(err_str)s. Trying again in '
'%(sleep_time)d seconds.') % log_info)
time.sleep(sleep_time)
def ensure(self, error_callback, method, retry=None):