Firefox keeps trying to resolve cname-only https rr
Categories
(Core :: Networking: DNS, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox127 | --- | fixed |
People
(Reporter: lilydjwg, Assigned: valentin)
References
(Blocks 3 open bugs)
Details
(Whiteboard: [necko-triaged][necko-priority-next])
Attachments
(3 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0
Steps to reproduce:
open a matrix client and login into a mozilla.org account so firefox keeps polling the matrix for incoming messages.
Actual results:
Firefox keeps trying to resolve the https DNS record for mozilla.modular.im very frequently, maybe one for each HTTP request.
Expected results:
Shouldn't Firefox cache the result and calm down a bit?
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Networking: DNS' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•1 year ago
|
||
Thank you for reporting the issue.
I would expect DNS cache to be used.
Could you please share the output of about:networking#dns
Here it is. After I opened my matrix tab (app.schildi.chat), I did a "clear cache" first, observed repeated HTTPS record requests (for mozilla.modular.im which is the matrix server) via Wireshark, and then refreshed and took the screenshot.
Firefox does have the A record cached (I don't see repeated requests for it in Wireshark also), but not for the HTTPS record.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 4•1 year ago
|
||
| Assignee | ||
Comment 5•1 year ago
|
||
The test confirms that the DNS code works correctly. But I've reproduced the issue locally, and tracked down the problem to:
https://searchfox.org/mozilla-central/rev/c09764753ea40725eb50decad2c51edecbd33308/netwerk/protocol/http/nsHttpChannel.cpp#6613-6617
if (!LoadIsTRRServiceChannel() &&
(mLoadFlags & VALIDATE_ALWAYS ||
BYPASS_LOCAL_CACHE(mLoadFlags, LoadPreferCacheLoadOverBypass()))) {
mCaps |= NS_HTTP_REFRESH_DNS;
}
This means the host resolver is instructed to bypass the cache.
Considering how often this happens, this could actually be a perf issue.
We need to:
- Figure out if these flags are correct & if we should always refresh the cache when VALIDATE_ALWAYS is set
- Consider not refreshing the DNS cache if the negative cache entry is recent.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 6•1 year ago
|
||
This flag was previously being set for every page reload.
Only setting it for force-reload makes it so that we don't needlessly refresh
DNS cache entries and improves page load performance.
| Assignee | ||
Comment 7•1 year ago
|
||
Not sure if the change will break anything, but let's see.
https://treeherder.mozilla.org/jobs?repo=try&revision=bae8b2349219526ac8bc03b72ae3f1005fdfad86
Description
•