evilkost/brukva

Reconnection stops working

kmike opened this issue · 4 comments

I think it stops working after this change: 6f5514c#L1R321

_sudden_disconnect is raising exception now but on_reconnect is usually called after _sudden_disconnect. Exception pops up and prevents reconnection. This is quite easy to reproduce if redis is executed with 'timeout 1' option.

The traceback (not so useful though):

ERROR:brukva.client:Socket closed on remote end
ERROR:root:Exception in callback <functools.partial object at 0x102966470>
Traceback (most recent call last):
  File "/Users/kmike/svn/tornado/tornado/ioloop.py", line 345, in _run_callback
    callback()
  File "/Users/kmike/svn/tornado/tornado/stack_context.py", line 173, in wrapped
    callback(*args, **kwargs)
  File "/Users/kmike/svn/brukva/brukva/adisp.py", line 111, in _send_result
    self.call(self.g.throw(result))
  File "/Users/kmike/dev/planor/realtime/handlers/pubsub.py", line 27, in change_active_sessions_count
    session_count = yield self.redis.async.hincrby('active_sessions', sessionid, diff)
ConnectionError: Socket closed on remote end

I think it's fixed here: branch reconnect . Can you confirm for your case?

Hi, thanks for working on this!
I can confirm that reconnections works in my case now.

The recent changes seems to broke the assumption that brukva.client.Client.listen callbacks will receive brukva.client.Message instance as a first parameter (sometimes None is received and it causes AttributeErrors in my code). That's easy to fix on my side though. Is this change intended?

sometimes None is received and it causes AttributeErrors in my code

This is a bug, i am sure it is related to issue #7
Please check latest version: d47eff4, it should work now.

Yes, I can't reproduce AttributeErrors with the latest version.