vanvalenlab/kiosk-redis-janitor

Janitor crashes if it cannot connect to Redis

Opened this issue · 2 comments

Encountered the following error during kiosk startup (Redis is not yet ready I assume)

[2019-05-29 22:26:23,598]:[INFO]:[clean-redis.py]: Janitor Initialized.
[2019-05-29 22:26:24,614]:[CRITICAL]:[clean-redis.py]: Fatal Error: ConnectionError: Error 111 connecting to redis-master:6379. Connection refused.
[2019-05-29 22:26:24,618]:[CRITICAL]:[clean-redis.py]: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 492, in connect
    sock = self._connect()
  File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 550, in _connect
    raise err
  File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 538, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "clean-redis.py", line 112, in <module>
    janitor.clean()
  File "/usr/src/app/redis_janitor/janitors.py", line 234, in clean
    for q in self.get_processing_keys(count=100):
  File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 1767, in scan_iter
    cursor, data = self.scan(cursor=cursor, match=match, count=count)
  File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 1754, in scan
    return self.execute_command('SCAN', *pieces)
  File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 772, in execute_command
    connection = pool.get_connection(command_name, **options)
  File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 994, in get_connection
    connection.connect()
  File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 497, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to redis-master:6379. Connection refused.

/usr/local/lib/python3.6/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)

Update: The RequestsDependencyWarning is caused by conflicting versions inside the kubernetes 9.0.0 install.

I think this is related to #5

The cause of this issue is that the SCAN_ITER call does not get wrapped inside the retry loop. I believe this has to do with the generator function itself (so a faulty wrapping job inside the redis client).