Redis cache server not running. Please contact Administrator / Tech support | VS-Code Debugger Issue

redis.exceptions.ConnectionError: Error 111 connecting to localhost:13000. Connection refused.

The version I’m using

ERPNext: v13.43.1 (version-13)

Frappe Framework: v13.47.0 (version-13)

Note: I’m using ERPNext without docker I want to run my project in debugger mode. This my moto

I tried to setup the Debugger through this official Frappe Documentation This for Version-14

.vscode/launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Bench",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/apps/frappe/frappe/utils/bench_helper.py",
            "args": [
                "frappe", "serve", "--port", "8000", "--noreload", "--nothreading"
            ],
            // "pythonPath": "${workspaceFolder}/../env/bin/python",
            "cwd": "${workspaceFolder}/sites",
            "env": {
                "DEV_SERVER": "1"
            }
        }
    ]
}

Procfile

redis_cache: redis-server config/redis_cache.conf
redis_socketio: redis-server config/redis_socketio.conf
redis_queue: redis-server config/redis_queue.conf

web: bench serve --port 8000

socketio: /usr/local/bin/node apps/frappe/socketio.js

watch: bench watch

schedule: bench schedule
worker_short: bench worker --queue short 1>> logs/worker.log 2>> logs/worker.error.log
worker_long: bench worker --queue long 1>> logs/worker.log 2>> logs/worker.error.log
worker_default: bench worker --queue default 1>> logs/worker.log 2>> logs/worker.error.log

when I’m running through the debugger my project is running but Redis is not running

error

127.0.0.1 - - [17/Jan/2023 11:03:19] "GET /api/method/frappe.desk.reportview.get_list?fields=%5B%22name%22%2C%22filter_name%22%2C%22for_user%22%2C%22filters%22%5D&filters=%7B%22reference_doctype%22%3A%22Employee%22%7D&or_filters=%5B%5B%22for_user%22%2C%22%3D%22%2C%22Administrator%22%5D%2C%5B%22for_user%22%2C%22%3D%22%2C%22%22%5D%5D&doctype=List+Filter&limit=20&_=1673933588292 HTTP/1.1" 200 -
127.0.0.1 - - [17/Jan/2023 11:03:20] "POST /api/method/frappe.desk.reportview.get HTTP/1.1" 200 -
Traceback (most recent call last):
  File "env/lib/python3.10/site-packages/redis/connection.py", line 559, in connect
    sock = self._connect()
  File "env/lib/python3.10/site-packages/redis/connection.py", line 615, in _connect
    raise err
  File "env/lib/python3.10/site-packages/redis/connection.py", line 603, 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 "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 38, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1457, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/doctype/route_history/route_history.py", line 66, in deferred_insert
    _deferred_insert("Route History", json.dumps(routes))
  File "apps/frappe/frappe/deferred_insert.py", line 10, in deferred_insert
    frappe.cache().rpush(queue_prefix + doctype, records)
  File "apps/frappe/frappe/utils/redis_wrapper.py", line 140, in rpush
    super(RedisWrapper, self).rpush(self.make_key(key), value)
  File "env/lib/python3.10/site-packages/redis/client.py", line 2016, in rpush
    return self.execute_command('RPUSH', name, *values)
  File "env/lib/python3.10/site-packages/redis/client.py", line 898, in execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
  File "env/lib/python3.10/site-packages/redis/connection.py", line 1192, in get_connection
    connection.connect()
  File "env/lib/python3.10/site-packages/redis/connection.py", line 563, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:13000. Connection refused.

Please help me to setup the debugger.

Note:

I tried this command it’s working fine but if i try to run the project in debug I’m getting this error

bench start

Have you missed bench start?

You just need to remove the processes that need to be attached to debugger from Procfile. Keep the rest of the Procfile and run bench start. E.g. if you wish to debug werkzeug/frappe remove web, if you wish to debug default worker remove worker_default. Attach the removed processes using VS Code.

1 Like

How can I do

bench start

and also the debugger at the same time, if I try that it shows the error port already used

This is my Prockfile settings
Prockfile

redis_cache: redis-server config/redis_cache.conf
redis_socketio: redis-server config/redis_socketio.conf
redis_queue: redis-server config/redis_queue.conf

web: bench serve --port 8000

socketio: /usr/local/bin/node apps/frappe/socketio.js

watch: bench watch

schedule: bench schedule
worker_short: bench worker --queue short 1>> logs/worker.log 2>> logs/worker.error.log
worker_long: bench worker --queue long 1>> logs/worker.log 2>> logs/worker.error.log
worker_default: bench worker --queue default 1>> logs/worker.log 2>> logs/worker.error.log

:white_check_mark: Solution :white_check_mark: