Revalidate stale DNS answers in Happy Eyeballs
Categories
(Core :: Networking: HTTP, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox156 | --- | fixed |
People
(Reporter: mail, Assigned: mail)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
Attachments
(3 external files)
Firefox already serves DNS answers from a cache entry's grace period (stale-while-revalidate). Teach Happy Eyeballs to notice when an answer was served stale: race it immediately, revalidate with a cache-bypassing lookup, and race the revalidated answer too.
Builds on the happy-eyeballs crate v0.11.0 stale/allow_stale API (bug 2060591)
Seed a short-TTL A record by driving one connection through Happy
Eyeballs, let it age into the grace period, then answer the name with a
working address. The stale address is raced first and its connection is
refused; Happy Eyeballs revalidates with a cache-bypassing lookup, races
the address that comes back, and the request succeeds on it.
Serving a stale entry also makes the resolver renew it in the
background, and that renewal alone is enough to reach the working
address: it updates the shared host record, so a lookup landing after it
sees the new address, and the test would pass with or without the
revalidation. DNS therefore goes through the TRR server, whose answers
can be delayed: the revalidated answer is held back until Happy Eyeballs
has consumed the stale one and failed to connect to it. TRR_ONLY mode
keeps native resolution, which answers 127.0.0.1 for everything in TRR
tests, out of the picture as well.
Firefox already serves DNS answers from a cache entry's grace period
(stale-while-revalidate). This teaches Happy Eyeballs to notice when an
answer was served stale and race it immediately while revalidating with
a fresh, cache-bypassing lookup, then race the revalidated answer too.
- Expose nsIDNSAddrRecord::fromStaleCache, backed by the resolver's
existing grace-period check (CheckExpiration == EXP_GRACE), rather than
reasoning from the record's ttl and lastUpdate: lastUpdate only moves
when the address set changes, so a repeatedly refreshed but stable host
would otherwise look perpetually stale. - Plumb happy-eyeballs v0.11.0's stale/allow_stale API through the FFI
glue and the C++ driver. Output::SendDnsQuery carries allow_stale;
when the state machine revalidates a stale answer (allow_stale=false)
the driver adds RESOLVE_BYPASS_CACHE | RESOLVE_REFRESH_CACHE. - happy_eyeballs_process_dns_response_{a,aaaa,https} carry the stale flag
into Input::DnsResult. A/AAAA answers report fromStaleCache; HTTPS
records do not expose grace status yet, so they are reported fresh.
The DNSRecord IPC struct carries the flag too, sampled when the lookup
completes: the receiving side holds no expiration times of its own, so
it cannot recompute grace status, and ttl plus lastUpdate is exactly the
reasoning rejected above.
The Happy Eyeballs DNS profiler markers now record two facts introduced
by Optimistic DNS: whether a query was a cache-bypassing revalidation of
a stale answer (allow_stale=false), and whether the answer it received
was served from a stale (past-TTL, grace-period) cache entry. This makes
the revalidation flow visible when profiling a connection.
Updated•3 months ago
|
Backed out for causing wpt failures @ drm-mp4-playback-temporary-playduration.https.html
Comment 9•3 months ago
|
||
Reverted this because it was causing wpt failures in video_dynamic_poster_absolute.htm.
- Revert link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | /html/semantics/embedded-content/the-video-element/video_dynamic_poster_absolute.htm | Testing http://web-platform.test:8000/html/semantics/embedded-content/the-video-element/video_dynamic_poster_absolute.htm == http://web-platform.test:8000/html/semantics/embedded-content/the-video-element/video_dynamic_poster-ref.htm
| Assignee | ||
Comment 10•3 months ago
|
||
Neither I nor Kershaw can reproduce the above failure on latest main. See e.g.:
https://treeherder.mozilla.org/jobs?repo=try&revision=a460df3a1c24b0bc11336776bb4c3ebda3c70411
Thus attempting another landing. In case my patch is the actual root cause, I am sorry for the trouble in advance.
Comment 11•3 months ago
|
||
Comment 12•3 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/4bc2d1107eff
https://hg.mozilla.org/mozilla-central/rev/cc97ac2dfe21
https://hg.mozilla.org/mozilla-central/rev/7f788ec4c025
Updated•2 months ago
|
Description
•