Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionLost during authentication causes txredisapi to stop retrying #126

Open
k2nsloos opened this issue Mar 19, 2018 · 0 comments
Open
Labels

Comments

@k2nsloos
Copy link

Hi all, today I noticed that my application using txredisapi suddenly stopped.

The log showed:

[BaseRedisProtocol (TLSMemoryBIOProtocol),client] <twisted.internet.tcp.Connector instance at 0x7f15fcda1440> will retry in 8 seconds
[BaseRedisProtocol (TLSMemoryBIOProtocol),client] <twisted.internet.tcp.Connector instance at 0x7f15fcd85e60> will retry in 9 seconds
[BaseRedisProtocol (TLSMemoryBIOProtocol),client] <twisted.internet.tcp.Connector instance at 0x7f15fcda16c8> will retry in 9 seconds
[BaseRedisProtocol (TLSMemoryBIOProtocol),client] <twisted.internet.tcp.Connector instance at 0x7f15fcd85f38> will retry in 9 seconds
Stopping factory <redis.txredisapi.RedisFactory instance at 0x7f15fcd85d40>
[-] Discarding dead connection.
message repeated 4 times: [ [-] Discarding dead connection.]

So far so good, but on reconnect I got:
Redis error: could not auth: Lost connection

Well thought the redis api ought to reconnect if the proper flag was set...
On inspection of the BaseRedisProtocol class I noticed the following

 def connectionMade(self):
        if self.factory.password is not None:
            try:
                response = yield self.auth(self.factory.password)
                if isinstance(response, ResponseError):
                    raise response
            except Exception as e:
                self.factory.continueTrying = False
                self.transport.loseConnection()

                msg = "Redis error: could not auth: %s" % (str(e))
                self.factory.connectionError(msg)
                if self.factory.isLazy:
                    log.msg(msg)
                defer.returnValue(None)

The retries are stopped if an exception is raised during auth...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants