2

My redis server is running under ubuntu 16.04 and I have RQ Dashboard running to monitor the queue. The redis server has a password which I supply for the initial connection. Here's my code:

from rq import Queue, Connection, Worker
from redis import Redis
from dblogger import DbLogger

def _redisCon():
    redis_host = "192.168.1.169"
    redis_port = "6379"
    redis_password = "SecretPassword"
    return Redis(host=redis_host, port=redis_port, password=redis_password)

rcon = _redisCon()
if rcon is not None:
    with Connection(rcon):  
        DbLogger.log("rqworker", 0, "Launching Worker", "launching an RQ Worker - default Queue")
        worker = Worker(list(map(Queue, 'default'))) # this works - I see the worker registered in RQ dashboard
        worker.work()  # this eventually fails with the Connection error: 

"""
16:28:49 RQ worker 'rq:worker:steve-imac.95379' started, version 0.12.0
16:28:49 *** Listening on default...
16:28:49 Cleaning registries for queue: default
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/redis/connection.py", line 177, in _read_from_socket
    raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/redis/client.py", line 668, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/redis/client.py", line 680, in parse_response
    response = connection.read_response()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/redis/connection.py", line 624, in read_response
    response = self._parser.read_response()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/redis/connection.py", line 284, in read_response
    response = self._buffer.readline()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/redis/connection.py", line 216, in readline
    self._read_from_socket()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/redis/connection.py", line 191, in _read_from_socket
    (e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/redis/connection.py", line 489, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 61 connecting to 192.168.1.169:6379. Connection refused.
"""

I've tried removing the password and enabling the unixsocket in the redis.conf -- neither seemed to help. This seems to be happening in some sort of timeout, since in other testing the worker actually loads a task and executes it before eventually dying with this error.

Steve L
  • 1,523
  • 3
  • 17
  • 24
  • I can reproduce the issue with running redis locally, and rq-dasboard. With or without a password on redis (and the right options for rq-dashboard). I tested 0.3.12, 0.3.11, 0.3.10 versions. All are broken, I don't understand as it used to work – caub Oct 19 '18 at 17:21

0 Answers0