From c665f809f2914fdd5cea4b31a49ec3c55acc95d3 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 29 Jan 2019 19:28:48 +0000 Subject: [PATCH] run-dev: Make address-in-use errors more obvious. This seems to be a common enough pitfall to justify a bit of extra handling. Example output: $ ./tools/run-dev.py Clearing memcached ... Flushing memcached... OK Starting Zulip services on ports: web proxy: ... Note: only port 9991 is exposed to the host in a Vagrant environment. ERROR: You probably have another server running!!! Traceback (most recent call last): File "./tools/run-dev.py", line 421, in app.listen(proxy_port, address=options.interface) File "/srv/zulip-py3-venv/lib/python3.5/... server.listen(port, address) File "/srv/zulip-py3-venv/lib/python3.5/... sockets = bind_sockets(port, address=address) File "/srv/zulip-py3-venv/lib/python3.5/... sock.bind(sockaddr) OSError: [Errno 98] Address already in use Terminated --- tools/run-dev.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/run-dev.py b/tools/run-dev.py index 07c09983d5..04530864b5 100755 --- a/tools/run-dev.py +++ b/tools/run-dev.py @@ -417,7 +417,12 @@ print("".join((WARNING, try: app = Application(enable_logging=options.enable_tornado_logging) - app.listen(proxy_port, address=options.interface) + try: + app.listen(proxy_port, address=options.interface) + except OSError as e: + if e.errno == 98: + print('\n\nERROR: You probably have another server running!!!\n\n') + raise ioloop = IOLoop.instance() for s in (signal.SIGINT, signal.SIGTERM): signal.signal(s, shutdown_handler)