summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-11-20 11:13:53 -0200
committerdrebs <drebs@riseup.net>2017-11-20 11:21:27 -0200
commitd74f27b75d69c37fac1587930508da6cd953f33c (patch)
tree0414d1447ba960562f26c3c3c1b8af86ee2bc78f
parent642541e2ab7f0c7eacd45ba013221e43db19fd7f (diff)
[bug] log and exit on server startup errors
Some errors during server startup could leave the server in a zombie state (running, but not listening). This commit makes sure the server stops if errors occur during deferreds created on server startup. Closes #8997.
-rw-r--r--src/leap/soledad/server/app.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/leap/soledad/server/app.py b/src/leap/soledad/server/app.py
index 725b1383..77d3a1cd 100644
--- a/src/leap/soledad/server/app.py
+++ b/src/leap/soledad/server/app.py
@@ -39,6 +39,12 @@ def _exit(status):
reactor.stop()
+def _log_and_exit(failure):
+ logger.error('Error while starting up server: %r'
+ % failure.getErrorMessage())
+ _exit(20)
+
+
#
# necessary checks
#
@@ -124,6 +130,7 @@ def run(application):
d = check_schema_versions(conf['couch_url'])
d.addCallback(lambda _: create_services(local_port, public_port,
application))
+ d.addErrback(_log_and_exit)
application = service.Application('soledad-server')