diff --git a/internal/experiment/webconnectivity/dnsresolvers.go b/internal/experiment/webconnectivity/dnsresolvers.go index be28399..4627f1d 100644 --- a/internal/experiment/webconnectivity/dnsresolvers.go +++ b/internal/experiment/webconnectivity/dnsresolvers.go @@ -249,6 +249,21 @@ func (t *DNSResolvers) lookupHostUDP(parentCtx context.Context, udpAddress strin ol.Stop(err) out <- addrs + + // wait for late DNS replies + t.WaitGroup.Add(1) + go t.waitForLateReplies(parentCtx, trace) +} + +// Waits for late DNS replies. +func (t *DNSResolvers) waitForLateReplies(parentCtx context.Context, trace *measurexlite.Trace) { + defer t.WaitGroup.Done() + const lateTimeout = 500 * time.Millisecond + events := trace.DelayedDNSResponseWithTimeout(parentCtx, lateTimeout) + if length := len(events); length > 0 { + t.Logger.Warnf("got %d late DNS replies", length) + } + t.TestKeys.AppendDNSLateReplies(events...) } // Divides queries generated by Do53 in Do53-proper queries and other queries. diff --git a/internal/experiment/webconnectivity/measurer.go b/internal/experiment/webconnectivity/measurer.go index 86012fa..fe844ba 100644 --- a/internal/experiment/webconnectivity/measurer.go +++ b/internal/experiment/webconnectivity/measurer.go @@ -36,7 +36,7 @@ func (m *Measurer) ExperimentName() string { // ExperimentVersion implements model.ExperimentMeasurer. func (m *Measurer) ExperimentVersion() string { - return "0.5.0" + return "0.5.1" } // Run implements model.ExperimentMeasurer. diff --git a/internal/experiment/webconnectivity/testkeys.go b/internal/experiment/webconnectivity/testkeys.go index de6bf45..267c9a4 100644 --- a/internal/experiment/webconnectivity/testkeys.go +++ b/internal/experiment/webconnectivity/testkeys.go @@ -30,6 +30,10 @@ type TestKeys struct { // Do53 contains ancillary observations collected by Do53 resolvers. Do53 *TestKeysDo53 `json:"x_do53"` + // DNSLateReplies contains late replies we didn't expect to receive from + // a resolver (which may raise eyebrows if they're different). + DNSLateReplies []*model.ArchivalDNSLookupResult `json:"x_dns_late_replies"` + // Queries contains DNS queries. Queries []*model.ArchivalDNSLookupResult `json:"queries"` @@ -161,6 +165,13 @@ func (tk *TestKeys) AppendNetworkEvents(v ...*model.ArchivalNetworkEvent) { tk.mu.Unlock() } +// AppendDNSLateReplies appends to DNSLateReplies. +func (tk *TestKeys) AppendDNSLateReplies(v ...*model.ArchivalDNSLookupResult) { + tk.mu.Lock() + tk.DNSLateReplies = append(tk.DNSLateReplies, v...) + tk.mu.Unlock() +} + // AppendQueries appends to Queries. func (tk *TestKeys) AppendQueries(v ...*model.ArchivalDNSLookupResult) { tk.mu.Lock()