Skip to content

Wait for shutdown instead of assuming it took under a second - #1303

Merged
levkk merged 1 commit into
pgdogdev:mainfrom
IgorOhrimenko:fix-flaky-shutdown-check
Aug 3, 2026
Merged

Wait for shutdown instead of assuming it took under a second#1303
levkk merged 1 commit into
pgdogdev:mainfrom
IgorOhrimenko:fix-flaky-shutdown-check

Conversation

@IgorOhrimenko

Copy link
Copy Markdown
Contributor

Problem

integration/complex/shutdown.sh sleeps for one second after asking PgDog to shut down, then fails the job if the process is still around. Draining the pools takes as long as it takes, and on a busy runner that is sometimes longer than a second, so the job fails with nothing actually wrong.

From a recent run — every server connection is closed, the check fires one second later, and the process exits right after:

07:29:18.48  closing server connection: state=idle, reason=pool offline  (last one)
07:29:19.49  6749
07:29:19.49  Shutdown failed
07:29:19.49  🐕 PgDog is shutting down immediately [SIGTERM]

It has failed this way on main as well (e37160da), and it flips between runs of the same commit.

Fix

Poll for up to ten seconds instead of guessing. A pooler that genuinely doesn't shut down still fails the test — it just no longer depends on how loaded the runner is.

Verified against a process that exits immediately (returns at once), one that exits after 2.5s (previously a failure, now passes), and one that never exits (still fails, after ~10s).

The shutdown test sleeps one second and fails if pgdog is still running.
Draining the pools takes as long as it takes, and on a busy runner that
is sometimes more than a second, so the job fails for no reason: the log
shows every server connection closed, then "Shutdown failed" one second
later, then the process exiting.

Poll for up to ten seconds instead. A pooler that really doesn't shut
down still fails the test, it just no longer depends on how loaded the
runner is.
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@levkk
levkk merged commit fdd62e7 into pgdogdev:main Aug 3, 2026
47 checks passed
@levkk

levkk commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants