After production setup site is running perfect but bench restart gives error

Hello,

My site is running perfect on local.

But still when I do bench restart it shows error.

khan@Umar:~/bench0$ bench restart
$ sudo supervisorctl restart bench0-workers: bench0-web:
bench0-workers:bench0-frappe-schedule: stopped
bench0-workers:bench0-frappe-long-worker-0: stopped
bench0-workers:bench0-frappe-short-worker-0: stopped
bench0-web:bench0-frappe-web: stopped
bench0-workers:bench0-frappe-schedule: started
bench0-workers:bench0-frappe-short-worker-0: started
bench0-workers:bench0-frappe-long-worker-0: started
bench0-web:bench0-frappe-web: started
bench0-web:bench0-node-socketio: ERROR (spawn error)
ERROR: sudo supervisorctl restart bench0-workers: bench0-web:
subprocess.CalledProcessError: Command 'sudo supervisorctl restart bench0-workers: bench0-web:' returned non-zero exit status 7.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/utils.py", line 41, in restart
    Bench(".").reload(web, supervisor, systemd)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 152, in reload
    restart_supervisor_processes(bench_path=self.name, web_workers=web, _raise=_raise)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py", line 321, in restart_supervisor_processes
    failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise)
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 158, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: sudo supervisorctl restart bench0-workers: bench0-web:

Thanks for any hint or suggestions to resolve it.

In terminal enter below command to edit supervisor.conf

sudo nano /etc/supervisor/supervisord.conf

Below [unix_http_server] enter this

chown=your_erp_user:your_erp_user

sve and close the file

after that restart supervisor with below command

sudo service supervisor restart

in your bench folder run command

bench setup supervisor
2 Likes

Same problem keeps happening with me even though I’ve tried the same solution you mentioned here. Any other suggestions?

Please share error screenshot to understand more about your issue.

Because above solution perfectly worked for me.

The bench is not able to restart and when I looked at the supervisor service if it is running, it keeps showing me that there is a problem. I tried to change the port of the supervisor, but it does not work.