Using redis-py's PubSub class I sometimes get the following exception:
Exception in thread listener_2013-10-24 12:50:31.687000:
Traceback (most recent call last):
File "c:\Python27\Lib\threading.py", line 551, in __bootstrap_inner
self.run()
File "c:\Python27\Lib\threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Users\Administrator\Documents\my_proj\my_module.py", line 69, in _listen
for message in _pubsub.listen():
File "C:\Users\Administrator\virtual_environments\spyker\lib\site-packages\redis\client.py", line 1555, in listen
r = self.parse_response()
File "C:\Users\Administrator\virtual_environments\spyker\lib\site-packages\redis\client.py", line 1499, in parse_response
response = self.connection.read_response()
File "C:\Users\Administrator\virtual_environments\spyker\lib\site-packages\redis\connection.py", line 306, in read_response
response = self._parser.read_response()
File "C:\Users\Administrator\virtual_environments\spyker\lib\site-packages\redis\connection.py", line 106, in read_response
raise ConnectionError("Socket closed on remote end")
ConnectionError: Socket closed on remote end
What would cause such an event?
If I catch this exception, what would be a reasonable handling logic? Would retrying listen() be futile?
The reason for asking and not simply trying is that I do not know how to reproduce this problem. It's rare but it's detrimental, so I must create some logic before this error strikes again.