Repository navigation
fix: SRV probe restarted by a host rename could expire without probing - #526
Merged
Merged
Conversation
`DnsRegistry::update_hostname` restarted an in-flight SRV probe by moving its `start_time` but left `next_send` alone. After a lost tiebreak `next_send` is a full second ahead, past `start_time + 750ms`, so the next `check_probing` found the probe already expired and moved the renamed SRV to active without ever probing it. The peer that owns the instance name never got a chance to answer, and two daemons announced the same instance name. This is the flaky `test_name_conflict_3`. Reset `next_send` with `start_time` and return true so the caller adds a timer at the new probe time. Also make `test_name_conflict_3` wait for server3's SRV (instance) `NameChange`, not the first `NameChange`, which is usually the host rename. Co-Authored-By: Claude Opus 5.5 <[email protected]>
keepsimple1
force-pushed
the
fix/issue-506-probe-restart
branch
from
October 25, 2026 04:06
d014188 to
e57c18d
Compare
keepsimple1
force-pushed
the
fix/issue-506-probe-restart
branch
from
October 25, 2026 04:33
d014188 to
1b832b7
Compare
keepsimple1
marked this pull request as ready for review
October 25, 2026 04:36
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.
Fixes #506.
Problem
The test case
test_name_conflict_3fails now and then: server3 never renames its instance, so server1 and server3 both announce the same instance name and the client sees only 2 distinct services instead of 3. Server3's SRV probe finishes without sending a single probe after the host rename. Server1 never gets a probe for the new SRV, so it never defends the name.Details
A host rename happens when the hostname’s address record (A, or AAAA for IPv6) conflicts with another host’s. In #506, server3’s
conflict3_host.local. A record clashed with server1’s, so the host becameconflict3_host-2.local.. It then clashed again with server2’s and becameconflict3_host-3.local..The SRV gets pulled in because its rdata names the host as its target. When the host is renamed,
update_hostnamerewrites the SRV’s target to the new name. That changes the SRV’s data, so its probe restarts, and that restart is the step the bug broke.Root cause
The bug is in
DnsRegistry::update_hostname. A host rename restarts the SRV probe that names the host, but it only movedstart_timeand leftnext_sendalone. In the #506 log, server3 lost a tiebreak on the SRV name, which setsnext_send = now + 1s. When the host rename then restarted the probe atnow + rand(0..250ms),next_sendwas later thanstart_time + 750ms. So the nextcheck_probingfound the probe already expired and moved the renamed SRV (host conflict3_host-3) to active without ever sending a probe for it. Server1 never saw a probe it could answer with conflicting rdata. That fits the log:probe ... finished: move 2 records to activewith nofound conflict ... TYPE_SRV, and no(3)anywhere.Where the lost tiebreak comes from: a daemon also receives its own looped-back probes. After a host rename, an older echo with
host conflict3_host.local.compares greater than our newconflict3_host-2.local.(.>-), so the daemon "loses" a tiebreak against itself. That's a separate wart, left as a follow-up. With this fix it only costs a 1 s delay and no longer skips probing.Changes
update_hostnameresetsnext_sendalong withstart_timeon restart, and returns true so the caller adds a timer at the new probe time.test_update_hostname_restarts_probe_send.test_name_conflict_3: server3's monitor now waits for the SRVNameChange(instance rename) instead of breaking on the firstNameChange, which is usually the A/host rename.