Unhandled exception when connect() fails #5

Closed
foresto opened this Issue Jul 20, 2011 · 5 comments

Comments

Projects
None yet
2 participants

foresto commented Jul 20, 2011

I love that haigha is smart enough to continually retry a failed connect (or reconnect), producing helpful log messages the whole time. On the first failed try, however, an unhandled exception spews a traceback onto my console:

2011-07-20 12:15:10 myapp DEBUG disconnecting connection
2011-07-20 12:15:10 myapp DEBUG Pending connect: None
2011-07-20 12:15:10 myapp DEBUG Scheduling a connection in 0
2011-07-20 12:15:10 myapp DEBUG Connecting to myhost on 5672
2011-07-20 12:15:10 myapp ERROR Failed to connect to myhost:5672, will try again in 2 seconds
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/haigha/connection_strategy.py", line 128, in _connect_cb
    self._connection.connect( self._cur_host.host, self._cur_host.port )
  File "/usr/local/lib/python2.7/dist-packages/haigha/connection.py", line 165, in connect
    self._sock.connect( (host,port) )
  File "/usr/local/lib/python2.7/dist-packages/eventsocket.py", line 243, in connect
    raise socket.error( err, os.strerror(err) )
error: [Errno 111] Connection refused

@ghost ghost assigned awestendorf Jul 21, 2011

Member

awestendorf commented Jul 22, 2011

This isn't an unhandled exception, it's a call to logger.exception in ConnectionStrategy._connect_cb()

foresto commented Jul 22, 2011

Since a message broker that hasn't yet started isn't exactly an unusual situation, it would be helpful to be able to silence the backtrace so real problems can more easily be spotted in the logs. A simple one-line log message would be nice. Is there a recommended way to do this?

Member

awestendorf commented Jul 26, 2011

Sure, that's sensible. I'll leave it as an exception when debugging is turned on.

foresto commented Aug 23, 2011

Was this supposed to have changed in haigha 0.3.2? It's still logging a traceback when debugging is not enabled.

Member

awestendorf commented Aug 23, 2011

It wasn't fixed, it's scheduled for the 0.3 series though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment