Skip to content

Make the DNS timeout self-test pass on a loaded build host - #2236

Merged
xroche merged 2 commits into
masterfrom
dns-selftest-no-upper-bounds
Nov 14, 2026
Merged

xroche merged 2 commits into
masterfrom
dns-selftest-no-upper-bounds

Conversation

@xroche

@xroche xroche commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

The DNS timeout self-test failed the Debian reproducible-builds run of 3.51.0-1 on forky amd64. A resolve that should return at once took more than 1.5 seconds on a loaded build host. The slow hosts now answer only when the test opens a gate at the end. So an empty result can only come from the timeout or the cancel.

A reviewer should know what this gives up. The test no longer catches a cancel or a lock wait that is slow but ends within 20 seconds. A bound tight enough to catch it is the one that failed here. A broken resolve still fails the test rather than hangs it, because the gate gives up after 20 seconds.

xroche and others added 2 commits November 14, 2026 16:49
The Debian reproducible-builds run of 3.51.0-1 failed on forky amd64 at
htsdns_selftest.c:704: a resolve with its cancel flag already raised
took more than 1.5 seconds. The host runs make -j42 with other builds,
and a thread can stall that long there.

The hosts whose resolve the test abandons (slow.test, slow4.test) now
block on a gate the test opens at the end, instead of sleeping 3s. A
resolve that returns with no answer then proves the timeout or cancel,
with no upper time bound. The state.lock probe becomes the cancel flag
of an unbounded resolve, so only a probe that got the lock mid-resolve
lets it return empty. The gate gives up after 20s, so a regression
fails the test instead of hanging it.

Controls: holding state.lock across the resolve, ignoring the cancel,
ignoring the deadline and silencing the worker tail each fail the test.
Freezing the process 2s with SIGSTOP at 0.3s fails the old test and
passes the new one at nine offsets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Review found that a late lock probe could write into a returned stack
frame and race the state.stop writes, and that the cut case swapped the
thread runner and backend while its worker could still be starting. The
probe is now static and joined with a bound, and both waits return
early on failure. Also fix the slow_ms comment, which predated
MOCK_GATED, and name the seven resolves the final wait counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche enabled auto-merge (squash) November 14, 2026 16:13
@xroche
xroche merged commit 9190431 into master Nov 14, 2026
41 checks passed
@xroche
xroche deleted the dns-selftest-no-upper-bounds branch November 14, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant