rig: record how pop exits, and reach its lifecycle paths - #204
Merged
Conversation
Stop() sent pop a signal and then threw away the exit status. Every test teardown goes through it, so pop's shutdown path was already among the most heavily exercised in the suite -- and a shutdown that panicked looked exactly like one that did not. Stop now records the exit, and ExitOK reports whether it was clean: exited on SIGINT rather than being killed after the grace period, status 0, no panic in the output. The panic text is reported too, because it is what identifies WHICH bug -- a WaitGroup driven negative reads "sync: negative WaitGroup counter". Reaping moves to a single waiter started at launch. That is what makes Alive() truthful: a process that has exited but has not been waited for is a zombie, and a zombie still accepts signal 0, so the obvious implementation would report a corpse as alive. That is not a hypothetical -- it gave a wrong diagnosis on the first run of these tests, reporting that pop had survived something it had died of. Signal, APICommand and EtcFile reach the lifecycle from outside: pop has two independent shutdown paths (a signal and the management API's stop command), and a config reload can only be triggered by SIGHUP after changing files in the directory pop insists its config lives in. The three tests here all pass as things stand. They are the floor: shutdown on one signal, on two, and on a signal racing the API's stop.
|
Warning Review limit reachedNext included review available in 10 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Rig capability only. Everything here passes on main as it stands; the tests that need #177 are in a separate PR stacked on it.
What was wrong
Stop()sent pop a signal and then discarded the exit status. Every test teardown goes through it, so pop's shutdown path was already one of the most heavily exercised in the suite — and a shutdown that panicked was indistinguishable from one that did not.ExitOK()now reports whether shutdown was clean: exited on SIGINT rather than being killed after the grace period, status 0, and no panic in the output. The panic text comes with it, because that is what identifies which bug — a WaitGroup driven negative readssync: negative WaitGroup counter.The zombie
Reaping moves to a single waiter started at launch, and
Alive()reads that rather than probing with signal 0.This is not a hypothetical tidy-up. A process that has exited but has not been waited for is a zombie, and a zombie still accepts signal 0 — so the obvious implementation reports a corpse as alive. It did exactly that on the first run of these tests, telling me pop had survived a reload it had in fact died of.
Reaching the lifecycle from outside
Signal,APICommandandEtcFile. pop has two independent shutdown paths — a signal, and the management API'sstopcommand — and a config reload can only be provoked by SIGHUP after changing files in the directory pop insists its config lives in.The tests
Three, all passing today, establishing the floor: shutdown on one signal, on two in quick succession, and on a signal racing the API's stop.
Worth stating plainly, since it bears on #177: none of them fails on main. I tried to reproduce the #159 double-
Donepanic through every interface the rig has and could not — single SIGINT, double SIGINT, and SIGINT racing an API stop all shut down cleanly, 6/6 on the last. After the firstwg.Done()the process exits before the dispatcher can dequeue a second event. These stand as regression tests, not as reproductions.