Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Error on Bench Restart after Control+C

This seems to be a recurrent error but there is no solution suggested.

If you interupt bench restart e.g. by pressing Control+C when in the middle of running, it becomes impossible to recover as bench restart doesn’t work thereafter.

     frappe-bench bench restart Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/erpuser/.bench/bench/cli.py", line 41, in cli
    bench_command()
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/erpuser/.bench/bench/commands/utils.py", line 26, in restart
    restart_supervisor_processes(bench_path='.', web_workers=web)
  File "/home/erpuser/.bench/bench/utils.py", line 519, in restart_supervisor_processes
    supervisor_status = subprocess.check_output(['sudo', 'supervisorctl', 'status'], cwd=bench_path)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['sudo', 'supervisorctl', 'status']' returned non-zero exit status 4.

Is there a way to recover back from this?

We have tried:

  • Sudo supervisor restart all

  • sudo supervisor stop all, and then start all

  • sudo kill -9 sudo lsof -t -i:13001 and on port 12001, 11001 and 9001 without success