resolvematrix adds a secondary level of DNS caching TTL which is currently not configurable #2103
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity#2103
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Recently a friend moved their c10y server to a new host. Their DNS TTLs were reasonable values, but my c10y server failed to federate for some time until I unraveled the layers of DNS caching.
Within the main codebase, Hickory DNS is used directly and enforces a (configurable) minimum TTL, ignoring the TTL in the DNS record if it's below this value (default: 3h).
Additionally, c10y delegates to
resolvematrix. Unless a resolution cache value is explicitly set, it defaults to 24h (I am not sure this is the right default, but that's not the point of this issue). The current c10y usage ofMatrixResolverdoes not explicitly set a value, so 24h gets used.If I'm reading this correctly, the way c10y uses
resolvematrixcurrently creates a shadow cache of 24h which ignores the min TTL configuration of the server. This cache is separate from the hickory one.I'm opening this as an issue because I'm not familiar with the thinking around these 2 crates interaction, but I'd suggest one of the caches should go away.
This is a known issue and appropriately honouring relevant cache values is a planned change: continuwuation/resolvematrix#21
I'm going to close this issue since it's more relevant to resolvematrix instead of continuwuity directly. Feel free to re-open if you disagree!
Please keep open for tracking
@stratself I think we're intending to follow the DNS TTL, and then nex is working on code which will track down/alive systems so when the system comes alive after IP change things update appropriately.
@stratself wrote in #2103 (comment):
the issue for tracking is at continuwuation/resolvematrix#21. resolvematrix is separate software
Except that c10y explicitly passes in a DNS resolver to use, which comes from the
get_dns_resolverfunction, which does utilize the system config for DNS TTL values:.dns_resolver(dns_resolver.clone())It is correct that resolvematrix has a cache that defaults to 24 hours, however this is a full resolution cache, not just DNS. It can be cleared with the
!admin query resolver flush-cache --alladmin command. This clears both the 24h internal cache, as well as the DNS cache from hickory.The duration for the cache was discussed here in the dev room, a few weeks ago. As nex linked to, continuwuation/resolvematrix#21 is the issue for utilizing DNS TTL and Cache-Control headers. I have taken a stab at this issue in the past, but it is a lot more complex than it would initially seem.
Thanks for opening the bug on resolvematrix @nex! However, I consider it a bug in c10y that we have two separate DNS caches, one of which is configurable and one of which is not 🤔
Additionally, it appears that there is a bug in the path for
!admin query resolver flush-cache <server>. While--alldoes clear everything correctly, the server-specific path only clears the resolvematrix side. Any DNS caches from hickory would remain.I suppose that is probably be trackable as a separate issue. I'd be happy to work on these btw but I opened this issue to start a discussion on what the end state should be.
I guess it's technically a bug that hickory's dns cache exists at all, we should probably just remove that
I support that conclusion.