Explorar o código

Fix Celerybeat from hanging when using --detach mode after dispatching 1st set of tasks.

The change made in https://github.com/celery/celery/commit/022ee4ade9f7d03f995413212b135fe18451be95
caused file descriptor 0 (usually sys.stdin) not to be included in the list of file descriptors to keep.
Doing a filter(none) apparently removes this number from this list, which somehow causes sys.stdin to be closed.
Changed the logic to be filter(lambda: x is not None) to allow 0 to be included.

See https://github.com/celery/celery/pull/1822.
Roger Hu %!s(int64=11) %!d(string=hai) anos
pai
achega
682ea873bb
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      celery/platforms.py

+ 2 - 1
celery/platforms.py

@@ -266,7 +266,8 @@ def _create_pidlock(pidfile):
 if hasattr(os, 'closerange'):
 
     def close_open_fds(keep=None):
-        keep = list(uniq(sorted(filter(None, (
+        # using filter(None) causes 0 to be filtered out too
+        keep = list(uniq(sorted(filter(lambda x: x is not None, (
             maybe_fileno(f) for f in keep or []
         )))))
         maxfd = get_fdmax(default=2048)