Worker failures are invisible: disable_existing_loggers silences celery, and no service in the production compose file has a restart policy
Two independent defects that compound. Either alone is survivable; together, a dead worker is both unrecoverable and undetectable. Ours stayed dead for roughly 17 hours before a human noticed, with an empty log.
1. Celery's loggers are disabled, so fatal errors log nothing
api/src/backend/config/custom_logging.py builds LOGGING with:
disable_existing_loggers: True- loggers declared for gunicorn / django / db / security / api / tasks — none for
celery rootatERROR
Celery emits its fatal consumer error as logger.critical("Unrecoverable error: ...") on the
celery.worker logger. Because that logger exists by the time dictConfig runs and is not
named in the config, it is disabled outright. The worker dies with no output at all — no
CRITICAL, no traceback, nothing between the last routine INFO line and the process exiting 1.
We spent a considerable amount of effort chasing a "silent crash" that was never silent. After declaring the loggers explicitly — changing no behaviour, only giving existing messages a destination — the traceback appeared immediately on the first reproduction.
Naming only celery is not sufficient: the message is on celery.worker, and the child
stays disabled. The names that mattered for us:
for name in ("celery", "celery.worker", "celery.worker.consumer",
"celery.worker.consumer.consumer", "kombu", "kombu.transport.redis",
"billiard", "amqp"):
LOGGING["loggers"][name] = {
"handlers": ["<an existing console handler>"],
"level": LEVEL,
"propagate": False,
}This costs nothing at runtime and turns an unexplained container restart into a one-line diagnosis.
2. The production compose file declares no restart policy
docker-compose.yml self-identifies as # Production Docker Compose configuration and sets
restart: on no service except api-init ("no", correctly, since it is an init
container). Every long-running service therefore defaults to RestartPolicy=no: anything that
dies stays dead until a human notices, and a host reboot leaves the stack down.
For the worker specifically this is severe, because one worker owns the entire async plane —
in the shipped entrypoint, all nine queues (celery,scans,scan-reports,deletion,backfill, overview,integrations,compliance,attack-paths-scans). A dead worker means no scans, no
findings ingestion, no overview aggregates, no compliance scores, no exports, no deletions,
and no integration pushes.
3. Nothing reports the worker's absence
Compounding both:
LivenessViewreturns pass unconditionally ("Dependencies are intentionally not consulted"), and that is what the api healthcheck calls.ReadinessViewprobes postgres, valkey and the graph store, but never the consumer — so/health/readyreturns 200 with zero workers listening.- Neither
workernorworker-beatdeclares ahealthcheck. POST /scansreturns 202 Accepted regardless of whether anyone is consuming. The scan sits inavailable, the UI files it under ACTIVE, and it renders as in-progress indefinitely — celery's time limits only begin once a worker picks the task up.
So the only signal that the async plane is gone is a user eventually noticing a scan that never finishes.
worker-beat survives the same events structurally — beat is a pure producer, holds no
consumer connection, and never runs the mingle/gossip bootsteps — which makes the failure look
partial and even easier to miss.
Suggested changes
- Declare celery's loggers in
custom_logging.py(snippet above). - Set
restart: unless-stoppedon the long-running services in the production compose file, leavingapi-initat"no". - Give the workers a healthcheck —
celery -A config.celery inspect pingworks; it fails while the broker is down, which is the correct reading of "this worker cannot do its job". - Consider having
ReadinessViewconsult the consumer, so/health/readymeans what a load balancer assumes it means.
Context
Found while investigating a worker that dies on every broker restart. That underlying crash is
a kombu defect (stale fd in _fd_to_chan after reconnect, KeyError) and is being reported
separately — but the three items above are what turned a recoverable 15-second blip into 17
hours of undetected downtime, and they are all in this repo.
Source: prowler-cloud/prowler