Stop the publisher cluster as well as the subscriber (#470) - #471
Merged
ChronicallyJD merged 1 commit intoAug 7, 2026
Merged
Conversation
…ommandprompt#470) pgc_setup installs `trap pgc_teardown EXIT`. This suite then ran trap sub_cleanup EXIT which REPLACES it rather than adding to it, so sub_cleanup stopped the subscriber and the suite's own cluster was never stopped. The suite passed and left a live postmaster behind it every run. Measured on PG17, from a box reaped to zero orphans: delta 1 before, delta 0 after, PASSED both times. Gated on PG18 and PG19, with replication.sh alongside because it is the suite that already had this right and must stay right: 20 and 41 checks, all green. Why this is not cosmetic: the port band is finite, and a suite that cannot get a port fails after 8 start attempts with "could not create any TCP/IP sockets". That is indistinguishable from a real failure, and it lands on whichever suite happened to draw the exhausted port rather than on the one that leaked. 37 orphans had accumulated on the dev box and turned two majors of a gate red for reasons that had nothing to do with the code under test. objstore_module had the identical defect and was fixed in commandprompt#446. This is the last of the two the audit found. Worth noting that the audit had to be MEASURED rather than read: harness_selftest installs its own EXIT trap BEFORE pgc_setup, so by inspection pgc_setup should clobber it and leak the squatter, and it does not. Nothing detects this class of bug. A suite can leak a cluster and still report PASSED, which is why both instances survived until the band ran out. commandprompt#470 records that a harness-level before/after postmaster count would catch the category. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L2DvnWDM7g27ubDCQdXhky
This was referenced Aug 7, 2026
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.
Closes #470.
The defect
pgc_setupinstallstrap pgc_teardown EXIT.test/logical_subscriber.shthen installed its own:A second
trap ... EXITreplaces the first. So the subscriber cluster was stopped and the suite's own cluster never was. The suite passed, every run, and left a live postmaster behind.Measured, not argued
PG17, from a box reaped to zero orphaned postmasters:
Gated on PG18 and PG19, with
replication.shalongside because it is the suite that already chained correctly and must keep doing so:Why it is not cosmetic
The port band is finite. A suite that cannot get a port fails after 8 start attempts with
could not create any TCP/IP sockets, which is indistinguishable from a real red and is attributed to whichever suite drew the exhausted port, not to the one that leaked. 37 orphans had accumulated on the dev container and turned two majors of a gate red for reasons unrelated to the code under test.The audit behind it
objstore_modulehad the identical defect and was fixed in #446. This is the other one.The audit had to be measured rather than read, and that mattered:
harness_selftestinstalls its own EXIT trap at line 73, beforepgc_setupat line 90, so by inspectionpgc_setupshould clobber it and the squatter cluster should leak. Measured, it does not.harness_selftestlogical_subscriberreplicationpgc_teardownobjstore_moduleLeft open deliberately
Nothing in the harness detects this class. A suite can leak a cluster and still report PASSED, which is how both instances survived unnoticed. #470 records that a before/after postmaster count around each suite would catch the whole category rather than these two instances; that is a harness change and not this PR.