Repository navigation
fix: run postgresql container with init so orphaned healthcheck processes don't crash postgres - #14769
Conversation
… postmaster A pg_isready probe that times out under load exits with code 2. With postmaster as PID 1 it reaps the probe as an untracked child and restarts every backend. Running an init process as PID 1 keeps the probes away from postmaster.
New ConsoleProject ID: Tip Trigger functions via HTTP, SDKs, events, webhooks, or scheduled cron jobs |
🔵 Tier A · Mergeable after minor fixes
This enables Docker Compose’s init process for PostgreSQL in the main stack and in the Console’s generated compose file. The init process can reap orphaned healthcheck children before they are adopted by Postgres.
Fix with agent prompt### Issue 1
docker-compose.yml:1983
**Add a regression assertion for the installer output**
The existing `GeneratorTest` renders this compose file and checks the PostgreSQL service, but it does not assert that `init` survives in the rendered install compose. If the setting is removed or lost during generator changes, those tests will still pass and self-hosted installs will miss this fix.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 2
Merged |
| postgresql: | ||
| image: appwrite/postgres:0.1.0 | ||
| container_name: appwrite-postgresql | ||
| init: true |
There was a problem hiding this comment.
Add a regression assertion for the installer output
The existing GeneratorTest renders this compose file and checks the PostgreSQL service, but it does not assert that init survives in the rendered install compose. If the setting is removed or lost during generator changes, those tests will still pass and self-hosted installs will miss this fix.
Prompt To Fix With AI
This is a comment left during a code review.
Path: docker-compose.yml
Line: 1983
Comment:
**Add a regression assertion for the installer output**
The existing `GeneratorTest` renders this compose file and checks the PostgreSQL service, but it does not assert that `init` survives in the rendered install compose. If the setting is removed or lost during generator changes, those tests will still pass and self-hosted installs will miss this fix.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · testing · Reply if this doesn't apply.
…hcheck-init fix: run postgresql container with init so orphaned healthcheck processes don't crash postgres (cherry picked from commit c26afc9)

Postgres runs as PID 1 in the
postgresqlcontainer. When a healthcheck run exceeds Docker's timeout, Docker kills the probe's shell and any child it left gets reparented to PID 1. Postmaster reaps it as an untracked child, and if it exited non-zero, postmaster terminates all backends and runs crash recovery. API calls fail with500 general_unknownuntil recovery completes.Reported on self-hosted 2.5.0 with PostgreSQL 18.3 under bursty TablesDB load.
This adds
init: trueto the postgresql service indocker-compose.ymland the console compose generator. Docker's init process becomes PID 1 and reaps orphans, so postmaster never sees them.Tested with
appwrite/postgres:0.1.0and a healthcheck that leaves an orphan exiting with code 2: 5 crash restarts in 30s without init, none with--init.