Repository navigation
Conversation
A bare 'address already in use' masked a week-long outage (famelos#11975): the managed unit's bind failure produced only that raw OS error, so a hand-started daemon serving the same port from a different --config/data_dir looked, from any operator shell, exactly like the managed one working. Nobody watching the failing unit's own log could tell 'no daemon' from 'a DIFFERENT daemon already holds this port'. On a listen failure for either the public or admin address, dial the same address; if something answers, name the conflict explicitly instead of leaving the raw bind error to speak for itself. Deliberately not gated on errors.Is(listenErr, syscall.EADDRINUSE): Windows' invented syscall.EADDRINUSE does not match what net.Listen actually returns there (confirmed empirically against a real bind conflict on Windows) -- a direct dial is the portable signal instead.
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.
Summary
A bare "address already in use" masked a week-long outage on one deployment
(famelos#11975): the managed unit's bind failure produced only that raw OS
error in its log, so a hand-started daemon serving the same port from a
different
--config/data_dirlooked, from any operator shell, exactlylike the managed one working. Nobody watching the failing unit's own log
could tell "no daemon" from "a DIFFERENT daemon already holds this port" --
that ambiguity is what let the outage run for over a week undetected.
Change
On a listen failure for either the public or admin address,
Runnow dialsthe same address; if something answers, the returned error names the
conflict explicitly ("already serving: another process is already
listening on ...") instead of leaving the raw bind error to speak for
itself.
Deliberately not gated on
errors.Is(listenErr, syscall.EADDRINUSE): Itried that first, and Windows' invented
syscall.EADDRINUSEdoes not matchwhat
net.Listenactually returns there (confirmed empirically -- thecheck silently never fired on a real Windows bind conflict). A direct dial
against the address is the portable signal instead, independent of how each
platform phrases the underlying error.
Test plan
go build ./...go vet ./...go test ./...(all packages green)TestRun_RefusesWhenPublicPortHeldAndNamesTheConflict:starts one daemon, then starts a second with a different data_dir but
the same public port, and asserts the second fails fast with a
message containing "already serving" rather than a bare bind error.