ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

RAGflow Fails to Connect to Redis, Causing Indefinite File Processing

Open Promethean-Pty-Ltd opened this issue 6 months ago • 2 comments

Self Checks

  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (Language Policy).
  • [x] Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • [x] Please do not modify this template :) and fill in all the required fields.

RAGFlow workspace code commit ID

main

RAGFlow image version

infiniflow/ragflow:v0.19.0-slim

Other environment information

OS: macOS Sequoia
Browser: Chrome

Actual behavior

When uploading files to a knowledge base, the files get stuck in a "pending" state indefinitely and are never processed. The ragflow-worker container logs show repeated redis.exceptions.ConnectionError: Error 111 connecting to redis:6379. Connection refused. errors.

Expected behavior

Files uploaded to a knowledge base should be processed successfully without getting stuck in a "pending" state.

Steps to reproduce

1. Start RAGflow using the standard `docker-compose.yml` from the main branch.
2. Log in to the RAGflow UI.
3. Create a new knowledge base.
4. Upload a file to the knowledge base.

Additional information

[2024-06-18 05:10:20,833: ERROR/ForkPoolWorker-2] Task RAGFlow.tasks.task_file_upload[d1b3f4e9-0b3a-4c1e-8a8a-3e3e3e3e3e3e] raised unexpected: ConnectionError(111, 'Connection refused')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/redis/connection.py", line 619, in connect
    sock.connect(self.host_port)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/celery/app/trace.py", line 451, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/celery/app/trace.py", line 732, in __protected_call__
    return self.run(*args, **kwargs)
  File "/ragflow/RAGFlow/tasks.py", line 49, in task_file_upload
    kv_service = KVSession(self.request.id)
  File "/ragflow/RAGFlow/kb_service.py", line 41, in __init__
    self.conn = redis.Redis(host=REDIS_HOST, port=REDIS_PORT, db=1, password=REDIS_PASSWORD, decode_responses=True)
  File "/usr/local/lib/python3.10/dist-packages/redis/client.py", line 586, in __init__
    self.connection_pool = ConnectionPool(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/redis/connection.py", line 1333, in __init__
    self.connection_class(**self.connection_kwargs).connect()
  File "/usr/local/lib/python3.10/dist-packages/redis/connection.py", line 625, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to redis:6379. Connection refused.

"Attached are the docker-compose.yml and .env files for this issue, as they contain the relevant configuration details."

docker-compose copy.yml.txt env-copy.txt

Promethean-Pty-Ltd avatar Jun 18 '25 05:06 Promethean-Pty-Ltd

The "Connection refused" error to Redis usually means the Redis service isn't running, isn't reachable from your containers, or the configuration is mismatched. Here are the most relevant troubleshooting steps:

  1. Double-check that the Redis service is defined and running in your docker-compose.yml. The service should be named redis and expose port 6379.
  2. Make sure all RAGFlow containers use the correct Redis host and port—typically redis:6379 if using Docker Compose defaults. The environment variables REDIS_HOST, REDIS_PORT, and REDIS_PASSWORD must be consistent across all containers and match the Redis service config (sourcediscussion).
  3. From inside a running RAGFlow container, try telnet redis 6379 or redis-cli -h redis -p 6379 to confirm connectivity (discussion).
  4. If you see DNS or hostname resolution errors, check your Docker network settings or add an entry for redis in /etc/hosts (discussion).
  5. If Redis is running but you still get connection errors, check for port conflicts or firewall rules on your host.

If Redis is down or unreachable, file processing will remain stuck in "pending" because the worker can't queue or retrieve tasks. Once Redis is reachable, uploads should process as expected.

Let me know if you need help checking your Docker Compose or environment variable setup.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

dosubot[bot] avatar Jun 18 '25 05:06 dosubot[bot]

I have followed all the troubleshooting steps recommended by the bot, and the evidence suggests an application-level issue with how RAGflow is parsing Redis connection settings.

Here is a summary of the steps taken and their results:

Redis Service: I have confirmed that the Redis service is defined in docker-compose.yml and is running correctly. The docker-compose up command shows the ragflow-redis container starting and reaching a healthy state.

Redis Host and Port: The .env file correctly defines REDIS_HOST=redis and REDIS_PORT=6379. However, the application logs show that it is attempting to connect to redis:6379 as the host, which is incorrect.

Container Connectivity: I installed redis-tools in the ragflow-server container and successfully tested the connection to the Redis server using the following command:

docker exec ragflow-server redis-cli -h redis -p 6379 -a infini_rag_flow ping

This command returned a PONG, which confirms that the ragflow-server container can resolve the redis hostname and authenticate successfully.

DNS and Network: The successful connection test in the previous step also confirms that there are no DNS or networking issues between the containers.

Port Conflicts/Firewalls: Since the connection from within the container network was successful, this rules out any port conflicts or firewall issues.

Based on these findings, the root cause of the issue is not with the Redis server or the network configuration, but rather with the RAGflow application's inability to correctly parse the Redis host and port from the environment variables.

Promethean-Pty-Ltd avatar Jun 18 '25 06:06 Promethean-Pty-Ltd

Check the redis part in conf/service_conf.yaml in RAGFlow container. The host might be wrong.

KevinHuSh avatar Jun 20 '25 03:06 KevinHuSh