[Solved] Bench Update Error: Connection refused

System: Ubuntu Server 16.04 LTS

After successfully installing ERPNext with Easy Install, I attempted to start the bench with bench start. It was stuck generating CSS files for more than an hour and based on other user reports, I figured out, that it would probably be best to run bench update first, so I cancelled bench start.

During the updated, I’m faced with several exceptions.

Exception 1:

Traceback (most recent call last):

File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 484, in connect
sock = self._connect()
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 541, in _connect
raise err
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:
Exception 2:

Traceback (most recent call last):

File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/client.py”, line 667, in execute_command
connection.send_command(*args)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 610, in send_command
self.send_packed_command(self.pack_command(*args))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 585, in send_packed_command
self.connect()
File “/home/frappe/frappe-bench/env/lib/python3.5/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.

Exception 3:

Traceback (most recent call last):

File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 484, in connect
sock = self._connect()
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 541, in _connect
raise err
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

Exception 4:

Traceback (most recent call last):

File “/usr/lib/python3.5/runpy.py”, line 184, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.5/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 228, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 53, in migrate
router.sync_global_search()
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/router.py”, line 381, in sync_global_search
sync_global_search()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/global_search.py”, line 305, in sync_global_search
while frappe.cache().llen(‘global_search_queue’) > 0:
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 141, in llen
return super(RedisWrapper, self).llen(self.make_key(key))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/client.py”, line 1325, in llen
return self.execute_command(‘LLEN’, name)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/client.py”, line 673, in execute_command
connection.send_command(*args)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 610, in send_command
self.send_packed_command(self.pack_command(*args))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py”, line 585, in send_packed_command
self.connect()
File “/home/frappe/frappe-bench/env/lib/python3.5/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.

Edit: Bench start throws an error too, but is functional

Try…

service redis-server restart

or maybe even a check/restart of the supervisor subsystem, and check the mysql status

sudo systemctl status supervisor
#sudo systemctl restart supervisor #(if needed)
sudo systemctl status mysql

Thank you for the reply. Here are my results:

service redis-server restart

This command can only be run as sudo. Intentional? Anyway, nothing happens and it does not seem to solve the problem.

sudo systemctl status supervisor

Is active and running, but it reports the following:

Feb 26 09:26:54 frappeserv supervisord[3279]: 2019-02-26 09:26:54,031 CRIT Supervisor running as root (no user in config file)
Feb 26 09:26:54 frappeserv supervisord[3279]: 2019-02-26 09:26:54,031 WARN No file matches via include “/etc/supervisor/conf.d/*.conf”
Feb 26 09:26:54 frappeserv supervisord[3279]: 2019-02-26 09:26:54,169 INFO RPC interface ‘supervisor’ initialized
Feb 26 09:26:54 frappeserv supervisord[3279]: 2019-02-26 09:26:54,173 CRIT Server ‘unix_http_server’ running without any HTTP authentication checking
Feb 26 09:26:54 frappeserv supervisord[3279]: 2019-02-26 09:26:54,174 INFO supervisord started with pid 3279

sudo systemctl status mysql

Active and running, but it reports the following:

Feb 26 09:22:56 frappeserv mysqld[1468]: 2019-02-26 9:22:56 140700471822528 [Note] /usr/sbin/mysqld (mysqld 10.2.22-MariaDB-10.2.22+maria~xenial-log) starting as process 1468 …
Feb 26 09:22:56 frappeserv mysqld[1468]: 2019-02-26 9:22:56 140700471822528 [Warning] Could not increase number of max_open_files to more than 16364 (request: 21012)
Feb 26 09:22:56 frappeserv mysqld[1468]: 2019-02-26 9:22:56 140700471822528 [Warning] Changed limits: max_open_files: 16364 max_connections: 500 (was 500) table_cache: 7917 (was 10240)

Seems like a mysql settings problem to me. Have a look at this article and/or this article

I successfully increased the number and status mysql throws no errors anymore. However, it does not affect the problem, unfortunatly.

This problem is now, SOLVED!

In order for the update to be successfull, the bench must be active at the same time.

bench start
bench update # in a new terminal

Thank you @trentmu for your contribution.

5 Likes