Otherwise, in some environments (at least docker and kubernetes) it is possible that celery exits with error 1 without displaying the cause of the error. Closes #4594.
@@ -791,6 +791,7 @@ def check_privileges(accept_content):
uid=uid, euid=euid, gid=gid, egid=egid,
), file=sys.stderr)
finally:
+ sys.stderr.flush()
os._exit(1)
warnings.warn(RuntimeWarning(ROOT_DISCOURAGED.format(
@@ -74,6 +74,7 @@ class bgThread(threading.Thread):
self.on_crash('{0!r} crashed: {1!r}', self.name, exc)
self._set_stopped()
os._exit(1) # exiting by normal means won't work
@@ -91,6 +91,7 @@ class Timer(threading.Thread):
pass
except Exception as exc:
logger.error('Thread Timer crashed: %r', exc, exc_info=True)
def stop(self):