You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PostgreSQL readiness race in release-tooling-validation and publish-release-images (pg_isready passes against the image's temporary server) #501
Two jobs of ci.yml start a PostgreSQL container and test its readiness twice in a row. The first test can succeed against the temporary server that the PostgreSQL image starts during its own initialization. The second test then runs during the restart that replaces that server, gets no response, and fails the job.
Job
Step
Lines on master 4e45982
Message when it fails
release-tooling-validation
Smoke-test app (fail-closed)
846–847
PG not ready
publish-release-images
Smoke-test app image (fail-closed)
570–574
PostgreSQL did not become ready
Evidence
Seen once, on 2026-11-22, in run 45076346183, job release-tooling-validation, step Smoke-test app (fail-closed).
Fact
Value
Length of the step
5 seconds, 22:16:31Z to 22:16:36Z
Last lines of the step
/run/postgresql:5432 - accepting connections, then /run/postgresql:5432 - no response, then ##[error]PG not ready
The entrypoint of the postgres image starts a temporary server for its own setup and shuts it down again before it starts the real one. In the image in production, docker-entrypoint.sh lines 288–297: # start socket-only postgresql server for setting up or running scripts, with listen_addresses=''. That temporary server answers on the Unix socket only.
pg_isready run inside the container without -h uses the Unix socket. So the loop's first call can succeed against the temporary server, the loop ends at once, and the fail-closed check lands in the restart window. The loop was written to wait up to 30 seconds. In the failed run it did not wait at all.
A cold runner makes the window more likely: the images were pulled in that run, and seven other workflows were running at the same time.
Why it matters
publish-release-images runs on every push to master. The race there fails the release after the three images were built and before they are pushed. The result is no release for that commit, and a re-run of the job. It has not been seen in a publication so far. The one occurrence was in the rehearsal job.
Proposed correction (not made)
Test readiness over TCP in both jobs. The temporary server does not listen on TCP, so the check passes only when the real server is up:
pg_isready -h 127.0.0.1 -U gitwire -d gitops_hub
This goes into the loop and into the fail-closed check of both jobs. docker-build-app uses a service container with a health check (line 211) and has not shown the race.
State
Recorded on 2026-11-23 as an independent follow-up, by the maintainer's review of PR #499. Not fixed.
The fix is prepared in #506. It supersedes #505: the workflow change is the same, and the regression test was rewritten after two reviews on #505 found that it failed when the real server started between its two probes.
In CI the corrected test saw the defect once in a real container: the socket check answered accepting and then stopped answering, one time in 134 probes. The TCP check, after its first accept, never stopped answering.
Activity
Alajmah commentedon Nov 23, 2026
The fix is prepared in #506. It supersedes #505: the workflow change is the same, and the regression test was rewritten after two reviews on #505 found that it failed when the real server started between its two probes.
In CI the corrected test saw the defect once in a real container: the socket check answered accepting and then stopped answering, one time in 134 probes. The TCP check, after its first accept, never stopped answering.
fix(ci): every PostgreSQL readiness gate in CI waits over TCP (#501) (#…