Repository navigation
fix(http-postgres): the db's healthcheck counts no failed probe while Postgres starts - #250
Draft
slayerjain wants to merge 1 commit into
Draft
slayerjain wants to merge 1 commit into
slayerjain wants to merge 1 commit into
Conversation
… Postgres starts On a fresh volume Postgres runs initdb before it listens on TCP. On a loaded host that can outlast the healthcheck's 5 probes 2 s apart (about 10 s, no start_period): the db went unhealthy while it was still starting, and api, which waits for it with depends_on: service_healthy, failed with it. keploy's T2 lane (keploy/enterprise CI-AR-01) runs this compose file on its record and its CI checkout, and a slow initdb there was a red with nothing wrong. start_period: 10m: no failed probe counts while the db starts, and the first that passes marks it healthy, so a db that starts is waited on until it answers and no longer. One that exits still ends the wait at once (compose: "dependency failed to start: container ... exited"), and one that runs and never answers is unhealthy after start_period and 5 more probes. Checked on docker 29.7.2 and compose 5.5.1: a dependency that exits fails compose up in seconds, and one healthy only on its 12th probe, past the old 5, lets its dependent start. Signed-off-by: slayerjain <shubhamkjain@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
http-postgres/docker-compose.yml: thedbhealthcheck getsstart_period: 10m.Why
On a fresh volume Postgres runs initdb before it listens on TCP. The healthcheck gives that about 10 s: 5 probes, 2 s apart, with no start period. On a loaded host, initdb can take longer. The db then goes
unhealthywhile it is still starting, andapifails with it, because it waits ondepends_on: service_healthy.keploy's T2 CI lane (keploy/enterprise, CI-AR-01,
t2-flow-e2e) runs this compose file twice per compose cycle, for keploy record and for the CI checkout's keploy test. A slow initdb there turns the lane red when nothing is wrong. The lane's rule is to wait on progress, not on a clock. The healthcheck was the one wait in it that a clock bounded.Behaviour
start_perioddo not count. The first probe that passes marks the db healthy. A db that starts is waited on until it answers, and no longer.dependency failed to start: container ... exited (N).unhealthyafterstart_periodplus 5 more probes.Checked on docker 29.7.2 with compose 5.5.1. A dependency that exits fails
docker compose upwithin seconds. A dependency that turns healthy only on its 12th probe, after the old limit of 5, still lets its dependent start.The lane is pinned to this branch's commit for its proof. It moves to the merge commit once this merges.