Repository navigation
Add Recover for startup cleanup after an unclean exit - #3
Closed
johnmaguire wants to merge 1 commit into
Closed
johnmaguire wants to merge 1 commit into
johnmaguire wants to merge 1 commit into
Conversation
Consumers keep a marker file to decide whether a crashed predecessor left DNS configuration worth building a Manager to clear. NRPT rules, State keys, and resolver files already name their identity, and Windows adapter values are attributed through the rules that record the adapter, so the library can answer that itself: Recover probes the host without locks, returns at once when nothing of the identity's remains, and otherwise runs Close's final cleanup. A live holder is returned as ErrManagerAlreadyRunning because the caller asked for removal. Backends gain HasArtifacts, the read half of Clear. The catch-all smoke rows clean a detached set up with Recover and require a second call to find nothing.
johnmaguire
marked this pull request as ready for review
October 27, 2026 03:22
Member
Author
|
@matt-defined What do you think about this approach to remove the marker file that dnclient & nebula are currently writing? |
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.
Adds
Recover(ctx, Options) (changed bool, err error), a startup recovery for a process whose predecessor under the same identity exited without Close.Consumers today keep a marker file to decide whether a crashed predecessor left DNS configuration worth building a Manager to clear. NRPT rules, State keys, and resolver files already name their identity, and Windows adapter values are attributed through the rules that record the adapter, so the library can answer that itself. Recover probes the host without taking a lock or starting a change source, returns at once when nothing of the identity's remains, and otherwise runs the same final cleanup Close does, under the identity and host locks and bounded by ShutdownTimeout. Unlike Close it returns ErrManagerAlreadyRunning when a live holder keeps the identity, because the caller asked for removal and got none.
Backend.HasArtifactsis the read half of Clear on each backend; noop finds nothing.NewandRecovershare construction throughbuild.dnsconfigctl recover; the catch-all smoke rows now clean up a detached set with Recover and require a second call to find nothing.Smoke runs on this branch passed every row on macOS and Windows.