#12461·prowler

Worker failures are invisible: disable_existing_loggers silences celery, and no service in the production compose file has a restart policy

Author: kronkiedomCreated Aug 15, 2026Updated Sep 22, 2026
Labelsbugstatus/waiting-for-revisionseverity/high

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
  • root at ERROR

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:

python
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:

  • LivenessView returns pass unconditionally ("Dependencies are intentionally not consulted"), and that is what the api healthcheck calls.
  • ReadinessView probes postgres, valkey and the graph store, but never the consumer — so /health/ready returns 200 with zero workers listening.
  • Neither worker nor worker-beat declares a healthcheck.
  • POST /scans returns 202 Accepted regardless of whether anyone is consuming. The scan sits in available, 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

  1. Declare celery's loggers in custom_logging.py (snippet above).
  2. Set restart: unless-stopped on the long-running services in the production compose file, leaving api-init at "no".
  3. Give the workers a healthcheck — celery -A config.celery inspect ping works; it fails while the broker is down, which is the correct reading of "this worker cannot do its job".
  4. Consider having ReadinessView consult the consumer, so /health/ready means 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.