Error when loading site

I gotten this error when loading my site:

Don’t panic. It’s not you, it’s us.
Most likely, our engineers are updating the code, and it should take a minute for the new code to load into memory.

Checking the supervisor status:

frappe@server:~/frappe-bench$ sudo supervisorctl status
frappe-bench-redis:frappe-bench-redis-cache FATAL Exited too quickly (process log may have details)
frappe-bench-redis:frappe-bench-redis-queue FATAL Exited too quickly (process log may have details)
frappe-bench-redis:frappe-bench-redis-socketio FATAL Exited too quickly (process log may have details)
frappe-bench-web:frappe-bench-frappe-web RUNNING pid 5041, uptime 0:00:05
frappe-bench-web:frappe-bench-node-socketio RUNNING pid 4777, uptime 0:00:55
frappe-bench-workers:frappe-bench-frappe-default-worker-0 RUNNING pid 4706, uptime 0:01:00
frappe-bench-workers:frappe-bench-frappe-long-worker-0 RUNNING pid 4735, uptime 0:01:00
frappe-bench-workers:frappe-bench-frappe-schedule RUNNING pid 4705, uptime 0:01:00
frappe-bench-workers:frappe-bench-frappe-short-worker-0 RUNNING pid 4748, uptime 0:00:59

frappe@server:~/frappe-bench$ tail -n20 logs/redis-queue.error.log
frappe@server:~/frappe-bench$ tail -n20 logs/redis-queue.log

No errors in the redis queue, sockio or cache

frappe@server:~/frappe-bench$ bench start
13:55:24 system | redis_socketio.1 started (pid=7927)
13:55:24 redis_socketio.1 | .
13:55:24 redis_socketio.1 | .-__ ''-._ 13:55:24 redis_socketio.1 | _.- . . ‘’-._ Redis 2.8.17 (00000000/0) 64 bit
13:55:24 redis_socketio.1 | .- .-```. ```\/ _.,_ ''-._ 13:55:24 redis_socketio.1 | ( ' , .-` | `, ) Running in stand alone mode 13:55:24 redis_socketio.1 | |`-._`-...-` __...-.-.|'_.-'| Port: 12000 13:55:24 redis_socketio.1 | | -. ._ / _.-' | PID: 7940 13:55:24 redis_socketio.1 | -._ -._ -./ .-’ .-’
13:55:24 redis_socketio.1 | |-._-.
-.__.-' _.-'_.-'| 13:55:24 redis_socketio.1 | | -.
-._ _.-'_.-' | http://redis.io 13:55:24 redis_socketio.1 | -._ -._-..-'.-’ .-’
13:55:24 redis_socketio.1 | |-._-.
-.__.-' _.-'_.-'| 13:55:24 redis_socketio.1 | | -.
-._ _.-'_.-' | 13:55:24 redis_socketio.1 | -._ -._-.
.-‘.-’ .-’
13:55:24 redis_socketio.1 | -._ -..-’ _.-’
13:55:24 redis_socketio.1 | -._ _.-' 13:55:24 redis_socketio.1 | -.
.-’
13:55:24 redis_socketio.1 |
13:55:24 redis_socketio.1 | [7940] 05 Apr 13:55:24.519 # Server started, Redis version 2.8.17
13:55:24 redis_socketio.1 | [7940] 05 Apr 13:55:24.519 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
13:55:24 redis_socketio.1 | [7940] 05 Apr 13:55:24.519 * The server is now ready to accept connections on port 12000
13:55:24 system | watch.1 started (pid=7931)
13:55:24 system | worker_long.1 started (pid=7929)
13:55:24 system | web.1 started (pid=7935)
13:55:24 system | redis_queue.1 started (pid=7933)
13:55:24 redis_queue.1 | .
13:55:24 redis_queue.1 | .-__ ''-._ 13:55:24 redis_queue.1 | _.- . . ‘’-.
Redis 2.8.17 (00000000/0) 64 bit
13:55:24 redis_queue.1 | .- .-```. ```\/ _.,_ ''-._ 13:55:24 redis_queue.1 | ( ' , .-` | `, ) Running in stand alone mode 13:55:24 redis_queue.1 | |`-._`-...-` __...-.-.
|’_.-'| Port: 11000 13:55:24 redis_queue.1 | | -._ ._ / _.-' | PID: 7956 13:55:24 redis_queue.1 | -._ -._ -./ .-’ .-’
13:55:24 redis_queue.1 | |-._-.
-.__.-' _.-'_.-'| 13:55:24 redis_queue.1 | | -.
-._ _.-'_.-' | http://redis.io 13:55:24 redis_queue.1 | -._ -._-..-'.-’ .-’
13:55:24 redis_queue.1 | |-._-.
-.__.-' _.-'_.-'| 13:55:24 redis_queue.1 | | -.
-._ _.-'_.-' | 13:55:24 redis_queue.1 | -._ -._-.
.-‘.-’ .-’
13:55:24 redis_queue.1 | -._ -..-’ _.-’
13:55:24 redis_queue.1 | -._ _.-' 13:55:24 redis_queue.1 | -.
.-’
13:55:24 redis_queue.1 |
13:55:24 redis_queue.1 | [7956] 05 Apr 13:55:24.567 # Server started, Redis version 2.8.17
13:55:24 redis_queue.1 | [7956] 05 Apr 13:55:24.567 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
13:55:24 redis_queue.1 | [7956] 05 Apr 13:55:24.567 * The server is now ready to accept connections on port 11000
13:55:24 system | worker_default.1 started (pid=7943)
13:55:24 system | socketio.1 started (pid=7942)
13:55:24 system | worker_short.1 started (pid=7947)
13:55:24 system | schedule.1 started (pid=7946)
13:55:24 system | redis_cache.1 started (pid=7948)
13:55:24 redis_cache.1 | .
13:55:24 redis_cache.1 | .-__ ''-._ 13:55:24 redis_cache.1 | _.- . . ‘’-.
Redis 2.8.17 (00000000/0) 64 bit
13:55:24 redis_cache.1 | .- .-```. ```\/ _.,_ ''-._ 13:55:24 redis_cache.1 | ( ' , .-` | `, ) Running in stand alone mode 13:55:24 redis_cache.1 | |`-._`-...-` __...-.-.
|’_.-'| Port: 13000 13:55:24 redis_cache.1 | | -._ ._ / _.-' | PID: 7966 13:55:24 redis_cache.1 | -._ -._ -./ .-’ .-’
13:55:24 redis_cache.1 | |-._-.
-.__.-' _.-'_.-'| 13:55:24 redis_cache.1 | | -.
-._ _.-'_.-' | http://redis.io 13:55:24 redis_cache.1 | -._ -._-..-'.-’ .-’
13:55:24 redis_cache.1 | |-._-.
-.__.-' _.-'_.-'| 13:55:24 redis_cache.1 | | -.
-._ _.-'_.-' | 13:55:24 redis_cache.1 | -._ -._-.
.-‘_.-’ _.-’
13:55:24 redis_cache.1 | -._ -..-’ _.-’
13:55:24 redis_cache.1 | -._ _.-' 13:55:24 redis_cache.1 | -.
.-’
13:55:24 redis_cache.1 |
13:55:24 redis_cache.1 | [7966] 05 Apr 13:55:24.580 # Server started, Redis version 2.8.17
13:55:24 redis_cache.1 | [7966] 05 Apr 13:55:24.580 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
13:55:24 redis_cache.1 | [7966] 05 Apr 13:55:24.580 * The server is now ready to accept connections on port 13000
13:55:24 socketio.1 | listening on *: 8101
13:55:25 web.1 | Traceback (most recent call last):
13:55:25 web.1 | File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
13:55:25 web.1 | “main”, fname, loader, pkg_name)
13:55:25 web.1 | File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
13:55:25 web.1 | exec code in run_globals
13:55:25 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
13:55:25 web.1 | main()
13:55:25 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
13:55:25 web.1 | click.Group(commands=commands)(prog_name=‘bench’)
13:55:25 web.1 | File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
13:55:25 web.1 | return self.main(*args, **kwargs)
13:55:25 web.1 | File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
13:55:25 web.1 | rv = self.invoke(ctx)
13:55:25 web.1 | File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
13:55:25 web.1 | return _process_result(sub_ctx.command.invoke(sub_ctx))
13:55:25 web.1 | File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
13:55:25 web.1 | return _process_result(sub_ctx.command.invoke(sub_ctx))
13:55:25 web.1 | File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
13:55:25 web.1 | return ctx.invoke(self.callback, **ctx.params)
13:55:25 web.1 | File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
13:55:25 web.1 | return callback(*args, **kwargs)
13:55:25 web.1 | File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
13:55:25 web.1 | return f(get_current_context(), *args, **kwargs)
13:55:25 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
13:55:25 web.1 | ret = f(frappe._dict(ctx.obj), *args, **kwargs)
13:55:25 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py”, line 342, in serve
13:55:25 web.1 | frappe.app.serve(port=port, profile=profile, site=site, sites_path=‘.’)
13:55:25 web.1 | File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 220, in serve
13:55:25 web.1 | use_debugger=True, use_evalex=True, threaded=True)
13:55:25 web.1 | File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/serving.py”, line 685, in run_simple
13:55:25 web.1 | s.listen(LISTEN_QUEUE)
13:55:25 web.1 | File “/usr/lib/python2.7/socket.py”, line 224, in meth
13:55:25 web.1 | return getattr(self._sock,name)(*args)
13:55:25 web.1 | socket.error: [Errno 98] Address already in use
13:55:25 worker_default.1 | 13:55:25 RQ worker u’rq:worker:server.7962.default’ started, version 0.6.0
13:55:25 worker_default.1 | 13:55:25 Cleaning registries for queue: default
13:55:25 worker_default.1 | 13:55:25
13:55:25 worker_default.1 | 13:55:25 *** Listening on default…
13:55:25 system | web.1 stopped (rc=1)
13:55:25 system | sending SIGTERM to redis_socketio.1 (pid 7927)
13:55:25 system | sending SIGTERM to worker_long.1 (pid 7929)
13:55:25 system | sending SIGTERM to watch.1 (pid 7931)
13:55:25 system | sending SIGTERM to redis_queue.1 (pid 7933)
13:55:25 system | sending SIGTERM to schedule.1 (pid 7946)
13:55:25 system | sending SIGTERM to worker_default.1 (pid 7943)
13:55:25 system | sending SIGTERM to socketio.1 (pid 7942)
13:55:25 system | sending SIGTERM to redis_cache.1 (pid 7948)
13:55:25 system | sending SIGTERM to worker_short.1 (pid 7947)
13:55:25 redis_cache.1 | [7966 | signal handler] (1491414925) Received SIGTERM scheduling shutdown…
13:55:25 redis_socketio.1 | [7940 | signal handler] (1491414925) Received SIGTERM scheduling shutdown…
13:55:25 worker_default.1 | 13:55:25 Warm shut down requested
13:55:25 redis_queue.1 | [7956 | signal handler] (1491414925) Received SIGTERM scheduling shutdown…
13:55:25 system | schedule.1 stopped (rc=-15)
13:55:25 system | watch.1 stopped (rc=-15)
13:55:25 system | worker_short.1 stopped (rc=-15)
13:55:25 system | worker_long.1 stopped (rc=-15)
13:55:25 system | socketio.1 stopped (rc=-15)
13:55:25 redis_cache.1 | [7966] 05 Apr 13:55:25.581 # User requested shutdown…
13:55:25 redis_cache.1 | [7966] 05 Apr 13:55:25.581 # Redis is now ready to exit, bye bye…
13:55:25 system | redis_cache.1 stopped (rc=-15)
13:55:25 system | worker_default.1 stopped (rc=-15)
13:55:25 redis_socketio.1 | [7940] 05 Apr 13:55:25.625 # User requested shutdown…
13:55:25 redis_socketio.1 | [7940] 05 Apr 13:55:25.625 # Redis is now ready to exit, bye bye…
13:55:25 system | redis_socketio.1 stopped (rc=-15)
13:55:25 redis_queue.1 | [7956] 05 Apr 13:55:25.632 # User requested shutdown…
13:55:25 redis_queue.1 | [7956] 05 Apr 13:55:25.632 # Redis is now ready to exit, bye bye…
13:55:25 system | redis_queue.1 stopped (rc=-15)

frappe@server:~/frappe-bench$ sudo netstat -plnt | grep 8101
frappe@server:~/frappe-bench$

Fixed this by backing up the sql and reinstalling from scratch

Your existing processes have not been closed cleanly (this happens when you close a bench tab without hitting ctrl+c)

try

killall -m python
killall -m redis

If you don’t have killall install it!

@rmehta

Thanks for the reply, I’ll bear that in mind for the future!

In the meantime, please kindly close this topic

----- In addition for the sake of google spider -----

the above solution fixed “502 bad gateway” error