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

Migrating lpp.local
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
Updating customizations for Address
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/usource1/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/usource1/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/usource1/erpnext/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/usource1/erpnext/apps/frappe/frappe/commands/site.py", line 228, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/usource1/erpnext/apps/frappe/frappe/migrate.py", line 53, in migrate
    router.sync_global_search()
  File "/home/usource1/erpnext/apps/frappe/frappe/website/router.py", line 381, in sync_global_search
    sync_global_search()
  File "/home/usource1/erpnext/apps/frappe/frappe/utils/global_search.py", line 305, in sync_global_search
    while frappe.cache().llen('global_search_queue') > 0:
  File "/home/usource1/erpnext/apps/frappe/frappe/utils/redis_wrapper.py", line 141, in llen
    return super(RedisWrapper, self).llen(self.make_key(key))
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/redis/client.py", line 1325, in llen
    return self.execute_command('LLEN', name)
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/redis/client.py", line 673, in execute_command
    connection.send_command(*args)
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/redis/connection.py", line 610, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/redis/connection.py", line 585, in send_packed_command
    self.connect()
  File "/home/usource1/erpnext/env/lib/python2.7/site-packages/redis/connection.py", line 489, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:13000. Connection refused.
usource1@usource1-All-Series:~/erpnext$ 

pls help me with this

1 Like

Check this link, you may find it helpful.

We have the same issue here and the linked solution didn’t work.

We have tried to stop all processes, reboot, make bench start (at the same time with bench update in another tab).

All goes well until it comes this in the end of “bench start”:
redis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.
09:46:24 system | worker_short.1 stopped (rc=-15)
09:46:25 system | web.1 stopped (rc=-15)
09:46:25 system | worker_default.1 stopped (rc=-15)
09:46:25 system | worker_long.1 stopped (rc=-15)

And this comes in the end of “bench update”:
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/redis/connection.py”, line 489, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:13000. Connection refused.

I had this issue a few weeks back. It turns out there were some security updates on ubuntu 16.04 that effectively blocked off access to certain ports used by ERPNext. Check your most recent OS security updates changelog if you’re self- hosted as this is likely the cause. Unfortunately i can’t tell you how it was fixed as i got someone who’s better at linux than me to fix the issue as i didn’t know where to start from and didn’t want to mess things up.

Oh, that could be the case because there was indeed an update in the server and I just used the system 1 hour prior to that so thus I know for sure that it was working before that update.

Then roll back the update if you can’t find the problem. In my case that’s what i did until i could find someone who could effectively troubleshoot and fix the lock as a result of the update before going forward with it.

Ouch, I do not know what the server has done for the Ubuntu…

Restart the redis etc processes and see if it is able to connect again

sudo supervisorctl restart all
bench restart

Well, are you running the ERPNext server with:

bench start

…command on the server? Because I encountered the same error moments ago and realised that the bench server for ERPNext must be running to successful execute…

bench update --patch

which is what your output refers to.

Hope that’s what it is.

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 41, in cli
bench_command()
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/utils.py”, line 26, in restart
restart_supervisor_processes(bench_path=‘.’, web_workers=web)
File “/home/frappe/bench-repo/bench/utils.py”, line 519, in restart_supervisor_processes
supervisor_status = subprocess.check_output([‘sudo’, ‘supervisorctl’, ‘status’], cwd=bench_p
File “/usr/lib/python3.6/subprocess.py”, line 356, in check_output
**kwargs).stdout
File “/usr/lib/python3.6/subprocess.py”, line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘sudo’, ‘supervisorctl’, ‘status’]’ returned non-zero e
status 4.

any one can help i am getting this error trace when try to restart the bench

edit /etc/redis/redis.conf and change “port 6379” to “port 13000” then do a “systemctl restart redis”

2 Likes

I have exactly the same problem, except that the port number is 11000 after the pure installation of V13. Changing the port to 11000 makes “bench start” to exit immediately:
13:15:58 redis_cache.1 | 3968:M 31 Jan 2022 13:15:58.684 * Ready to accept connections
13:15:58 redis_cache.1 | 3968:signal-handler (1643634958) Received SIGTERM scheduling shutdown…
13:15:58 redis_socketio.1 | 3955:signal-handler (1643634958) Received SIGTERM scheduling shutdown…

and bench exits.
Running ‘bench update’ (with port 6379) at this moment just prolongs the agony till update ends…

Help, please…