# Delayed jobs stop processing after Postgres restart/maintenance. Pod stays Running, only a restart fixes it (6.5.2)

**URL:** <https://community.zammad.org/t/delayed-jobs-stop-processing-after-postgres-restart-maintenance-pod-stays-running-only-a-restart-fixes-it-6-5-2/21526>\
**Category:** Technical assistance\
**Created:** [November 26, 2026, 6:29am UTC](https://community.zammad.org/t/delayed-jobs-stop-processing-after-postgres-restart-maintenance-pod-stays-running-only-a-restart-fixes-it-6-5-2/21526 "2026-11-26T06:29:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![swaroopchenchu](https://community.zammad.org/user_avatar/community.zammad.org/swaroopchenchu/32/10668_2.png) [@swaroopchenchu](https://community.zammad.org/u/swaroopchenchu)\
**Post date:** [November 26, 2026, 6:29am UTC](https://community.zammad.org/t/delayed-jobs-stop-processing-after-postgres-restart-maintenance-pod-stays-running-only-a-restart-fixes-it-6-5-2/21526/1 "2026-11-26T06:29:05Z")

</div>

### Infos:

- Used Zammad version: 6.5.2
- Used Zammad installation type: zammad-helm 15.7.0 (with our own customisations), Kubernetes (GKE
- Operating system: Linux (container image on GKE)
- Browser + version: N/A (background job problem)
- Other info: External Cloud SQL PostgreSQL 16 and Elasticsearch. One scheduler replica, no liveness probe.

### Expected behavior:

- After the database is restarted or fails over and comes back, the scheduler’s background services ( ProcessDelayedJobs , ProcessScheduledJobs ) reconnect on their own. Delayed jobs keep being processed, or the process exits so Kubernetes restarts it.

### Actual behavior:

- After a Cloud SQL maintenance restart, the scheduler logs the errors below. ProcessDelayedJobs does not process jobs again.

- The scheduler pod stays Running with 0 restarts, so nothing alerts.

- Delayed jobs pile up ( in production). New tickets don’t reach Elasticsearch, so they are missing from search until someone restarts the scheduler.

- A scheduler restart recovers it and drains the backlog.

### Steps to reproduce the behavior:

- Run Zammad 6.5.2 with an external PostgreSQL and the scheduler as a single pod.

- Restart the database instance (a real restart; just killing connections with pg\_terminate\_backend recovers by itself).

- The scheduler logs the errors above once the DB goes down.

- Create a ticket after the DB is back. Delayed::Job.count keeps growing and the oldest job’s age keeps increasing. Nothing is processed and nothing is logged.

- Restart the scheduler. The queue drains.

- POSTGRESQL\_OPTIONS=pool=50&reaping\_frequency=10 , from this thread. We repeated the DB restart with it and the delayed-job thread still did not recover.

- Related: [#3149](https://github.com/zammad/zammad/issues/3149) and [#6558](https://github.com/zammad/zammad/issues/6558). [#6558](https://github.com/zammad/zammad/issues/6558) handles forked children, but our ProcessDelayedJobs runs as a thread ( start\_as\_thread in the trace).

- Is there a supported way to make the scheduler’s background threads recover from a lost DB connection?

- Does the [#6558](https://github.com/zammad/zammad/issues/6558) fix, or any later release, cover thread-based services?

- Is there a recommended health check (liveness probe or metric) for the background worker?

---

<div class="post-metadata">

**Author:** ![flexteam26\_zammad](https://community.zammad.org/letter_avatar_proxy/v4/letter/f/5e9695/32.png) [@flexteam26\_zammad](https://community.zammad.org/u/flexteam26_zammad)\
**Post date:** [November 26, 2026, 3:11pm UTC](https://community.zammad.org/t/delayed-jobs-stop-processing-after-postgres-restart-maintenance-pod-stays-running-only-a-restart-fixes-it-6-5-2/21526/2 "2026-11-26T15:11:46Z")

</div>

Thanks for the excellent report — the reproduction steps and the full stack trace make this unusually easy to follow, and the distinction between pg\_terminate\_backend (recovers fine) versus a real DB restart (stays stuck) is a really useful detail.

I can’t offer an official answer on whether #6558 covers the threaded services — that’s for the Zammad team to confirm. What I can share is what has worked for me in a similar setup (external Postgres + scheduler as its own pod): treat “the background threads died” as something Kubernetes should notice and act on, rather than expecting the process to exit cleanly.

Two practical pieces:

1. A small liveness probe that checks queue progress instead of just the HTTP port — e.g. a script run inside the scheduler container that reads Delayed::Job.count and the age of the oldest pending job (via zammad run rails c or a direct SQL query against the delayed\_jobs table), caches the values in a file, and exits non-zero if the oldest job’s age keeps growing across two consecutive checks while the pod stays Running. A liveness probe on that script turns “silent pile-up” into a pod restart, which is exactly the recovery you’re doing manually today — just automatically.

2. If you use monitoring (Prometheus or similar), exporting delayed\_jobs count + max age as a metric and alerting when the oldest job exceeds a few minutes gives you the same signal earlier, before search gaps appear for users.

It’s a workaround rather than a fix for the reconnect behaviour itself, but it removes the manual step in the meantime. One thing I’d be curious about: does ProcessScheduledJobs also stay dead after the restart, or only ProcessDelayedJobs? If scheduled jobs keep running while delayed ones stall, that might narrow down which connection handle is the one going stale.

---

<div class="post-metadata">

**Author:** ![swaroopchenchu](https://community.zammad.org/user_avatar/community.zammad.org/swaroopchenchu/32/10668_2.png) [@swaroopchenchu](https://community.zammad.org/u/swaroopchenchu)\
**Post date:** [November 27, 2026, 6:35am UTC](https://community.zammad.org/t/delayed-jobs-stop-processing-after-postgres-restart-maintenance-pod-stays-running-only-a-restart-fixes-it-6-5-2/21526/3 "2026-11-27T06:35:15Z")

</div>

Thanks, that’s helpful and we’ll implement the queue-age liveness probe.

To answer your question: in our test environment both ProcessScheduledJobs and ProcessDelayedJobs raised DatabaseConnectionError and stayed dead, with only Channel.fetch continuing.

In production only ProcessDelayedJobs stalled and ProcessScheduledJobs kept running, so it seems to depend on which service is mid-query when the DB drops.

We’ll keep this thread updated, and we’d still appreciate the Zammad team’s view on whether the threaded services are covered upstream.
