administrator@Server:~/erpnext$ bench start
16:56:14 system | redis_socketio.1 started (pid=8172)
16:56:14 system | worker_long.1 started (pid=8174)
16:56:14 system | watch.1 started (pid=8176)
16:56:14 system | web.1 started (pid=8179)
16:56:14 system | redis_queue.1 started (pid=8177)
16:56:14 system | schedule.1 started (pid=8180)
16:56:14 redis_socketio.1 | 8184:M 29 Sep 16:56:14.894 * Increased maximum number of open files to 10032 (it was originally set to 1024).
16:56:14 system | worker_default.1 started (pid=8181)
16:56:14 system | socketio.1 started (pid=8187)
16:56:14 redis_socketio.1 | 8184:M 29 Sep 16:56:14.894 # Creating Server TCP listening socket 127.0.0.1:12000: bind: Address already in use
16:56:14 system | redis_socketio.1 stopped (rc=1)
16:56:14 redis_queue.1 | 8193:M 29 Sep 16:56:14.896 * Increased maximum number of open files to 10032 (it was originally set to 1024).
16:56:14 redis_queue.1 | 8193:M 29 Sep 16:56:14.896 # Creating Server TCP listening socket 127.0.0.1:11000: bind: Address already in use
16:56:14 system | redis_queue.1 stopped (rc=1)
16:56:14 system | redis_cache.1 started (pid=8186)
16:56:14 system | worker_short.1 started (pid=8190)
16:56:14 system | sending SIGTERM to worker_long.1 (pid 8174)
16:56:14 system | sending SIGTERM to watch.1 (pid 8176)
16:56:14 system | sending SIGTERM to web.1 (pid 8179)
16:56:14 system | sending SIGTERM to schedule.1 (pid 8180)
16:56:14 system | sending SIGTERM to worker_default.1 (pid 8181)
16:56:14 system | sending SIGTERM to socketio.1 (pid 8187)
16:56:14 system | sending SIGTERM to redis_cache.1 (pid 8186)
16:56:14 system | sending SIGTERM to worker_short.1 (pid 8190)
16:56:14 redis_cache.1 | 8202:signal-handler (1538220374) Received SIGTERM scheduling shutdown…
16:56:14 redis_cache.1 | 8202:M 29 Sep 16:56:14.900 * Increased maximum number of open files to 10032 (it was originally set to 1024).
16:56:14 system | worker_long.1 stopped (rc=-15)
16:56:14 system | worker_short.1 stopped (rc=-15)
16:56:14 system | web.1 stopped (rc=-15)
16:56:14 system | schedule.1 stopped (rc=-15)
16:56:14 system | watch.1 stopped (rc=-15)
16:56:14 redis_cache.1 | 8202:M 29 Sep 16:56:14.901 # Creating Server TCP listening socket 127.0.0.1:13000: bind: Address already in use
16:56:14 system | redis_cache.1 stopped (rc=-15)
16:56:14 system | worker_default.1 stopped (rc=-15)
16:56:14 system | socketio.1 stopped (rc=-15)
administrator@Server:~/erpnext$
administrator@Server:~/erpnext$ sudo supervisorctl stop all
unix:///var/run/supervisor.sock no such file
administrator@Server:~/erpnext$ sudo service nginx stop
administrator@Server:~/erpnext$ bench start
17:47:31 system | redis_socketio.1 started (pid=11568)
17:47:31 system | watch.1 started (pid=11572)
17:47:31 system | redis_queue.1 started (pid=11574)
17:47:31 system | web.1 started (pid=11575)
17:47:31 system | worker_long.1 started (pid=11570)
17:47:31 system | worker_default.1 started (pid=11577)
17:47:31 redis_socketio.1 | 11581:M 29 Sep 17:47:31.757 * Increased maximum number of open files to 10032 (it was originally set to 1024).
17:47:31 redis_socketio.1 | 11581:M 29 Sep 17:47:31.757 # Creating Server TCP listening socket 127.0.0.1:12000: bind: Address already in use
17:47:31 redis_queue.1 | 11584:M 29 Sep 17:47:31.758 * Increased maximum number of open files to 10032 (it was originally set to 1024).
17:47:31 system | redis_socketio.1 stopped (rc=1)
17:47:31 redis_queue.1 | 11584:M 29 Sep 17:47:31.758 # Creating Server TCP listening socket 127.0.0.1:11000: bind: Address already in use
17:47:31 system | socketio.1 started (pid=11579)
17:47:31 system | redis_queue.1 stopped (rc=1)
17:47:31 system | redis_cache.1 started (pid=11590)
17:47:31 system | schedule.1 started (pid=11576)
17:47:31 system | worker_short.1 started (pid=11591)
Regarding your issue, 127.0.0.1:12000 and 127.0.0.1:11000 are already used, type sudo lsof -i -P -n | grep LISTEN to know the used IP addresses, and show the output then kill it manually, if nothing important is using it kill it so that supervisor uses that IP address netstat -lnp | grep 'tcp .*IPADDRESS:PORT' | sed -e 's/.*LISTEN *//' -e 's#/.*##' | xargs kill this is not a very clean way, but it works
Rebooting the OS might work sometimes, because you will start fresh, but that’s a lazy solution, and you wouldn’t know what is the cause and how you solved the issue.
I had the same problem. The issue was when I tried to use bench start. The bench was already started. I didn't have supervisor or nginx installed. When I checked the website, I found that the website was fine. Of course, The next step was to install supervisor and nginx.
I had the same problem. The issue was when I tried to use bench start. The bench was already started. I didn’t have supervisor or nginx installed. When I checked the website, I found that the website was fine. Of course, The next step was to install supervisor and nginx.
This was my solution. I had a test server that I was debugging on. The Office VPN dropped while in the middle of debugging.
Oddly, I had a redis service running under the ‘erp’ account that didn’t stop with supervisorctl or with systemctl.
Rebooting did fix it. I wonder if the previous bench start console was somehow running in a nohup mode or something.
I didn’t try killing the rogue processes, that would have probably fixed it without the reboot. I was worried that bench start had created a phantom terminal somewhere, so reboot cleaned it all out.
That might explain why the normal method works most of the time - but not always.
#!/usr/bin/env python3
""" stop.py is an attempt at creating an easy 'bench stop' command
Possible improvements:
- Refactor code and merge with bench
- check for production where stop command will use supervisor
- check for non-ubuntu platforms
"""
import os, socket, errno, time
# Declaring part of ports.
# Getting port suffix from current redis config.
ports = [1100, 1200, 1300, 900, 800, 500]
lines = {}
port_suffix = 0;
sockets = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
with open("./config/redis_cache.conf") as config_file:
for line in config_file:
key, value = line.partition(" ")[::2]
lines[key.strip()] = value.strip()
port_suffix = lines["port"][-1:]
config_file.close()
except IOError:
print('The file redis_cache.conf was not found. Are you sure you stop.py is in bench directory?')
exit();
# Closing open ports after combining each port prefix and suffix
for port in ports:
port = int("".join([str(port), str(port_suffix)]))
try:
sockets.bind(("127.0.0.1", port))
except socket.error as e:
if e.errno == errno.EADDRINUSE:
os.system("echo 'shutdown' | redis-cli -h 127.0.0.1 -p %d" % port)
time.sleep(3)
try:
sockets.bind(("127.0.0.1", port))
except socket.error as e:
if e.errno == errno.EADDRINUSE:
os.system("fuser %d/tcp -k" % port)
else:
print ('Port %d' % port, 'now closed')
else:
print ('Port %d' % port, 'already closed')
sockets.close()
sockets = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
continue
sockets.close()
print ('bench stopped')