Sfoglia il codice sorgente

Fix an incompatibility between python-daemon and multiprocessing, which resulted in the '[Errno 10] No child processes' problem when detaching.

Complete thanks to a StackOverflow answer by Anthony Towns: http://stackoverflow.com/questions/1359795/error-while-using-multiprocessing-module-in-a-python-daemon/1431666#1431666
mark hellewell 15 anni fa
parent
commit
e5085fb851
1 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. 6 2
      celery/bin/celeryd.py

+ 6 - 2
celery/bin/celeryd.py

@@ -80,7 +80,7 @@ from celery import conf
 from celery import discovery
 from celery import discovery
 from celery.task import discard_all
 from celery.task import discard_all
 from celery.worker import WorkController
 from celery.worker import WorkController
-from signal import signal, SIGHUP
+from signal import signal, SIGHUP, SIGCLD, SIG_DFL
 import multiprocessing
 import multiprocessing
 import traceback
 import traceback
 import optparse
 import optparse
@@ -182,7 +182,11 @@ def run_worker(concurrency=DAEMON_CONCURRENCY, detach=False,
         supervised=False, working_directory=None, chroot=None,
         supervised=False, working_directory=None, chroot=None,
         statistics=None, **kwargs):
         statistics=None, **kwargs):
     """Starts the celery worker server."""
     """Starts the celery worker server."""
-
+    # set SIGCLD back to the default SIG_DFL (before python-daemon overrode it)
+    # lets the parent wait() for the terminated child process and stops
+	# 'IOError: [Errno 10] No child processes' problem.
+    signal(SIGCLD, SIG_DFL)
+    
     print("Celery %s is starting." % __version__)
     print("Celery %s is starting." % __version__)
 
 
     if statistics:
     if statistics: