summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-10-07 16:48:46 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-10-07 16:48:46 +0200
commitb7b4979f03f4d06919e251cfcc24642ccf9407ad (patch)
tree97b137b406ce3a8bab2bfd0cccc6eaa6f03460ab
parent4426368369604224c971646eb334b212c69473f4 (diff)
Use 'forkserver' method for multiprocessing
Weird things happen when forking multithreaded programs without this.
-rw-r--r--daemon.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/daemon.py b/daemon.py
index 1198c32..a517978 100644
--- a/daemon.py
+++ b/daemon.py
@@ -3,10 +3,14 @@
if __name__ == '__main__':
import os
- import signal
import logging
logging.basicConfig(filename=os.environ.get('CODEQ_SERVER_LOG') or 'codeq-server.log', level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s')
- import server
+ import signal
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
+
+ import multiprocessing
+ multiprocessing.set_start_method('forkserver')
+
+ import server
server.socket.serve_forever()