feat(config): Separate NXDOMAIN DNS cache#5750
feat(config): Separate NXDOMAIN DNS cache#5750aminvakil wants to merge 11 commits intogetsentry:masterfrom
Conversation
|
I have zero rust knowledge and all of this is by Claude Sonnet 4.6 . Therefore I have converted it to draft, so I can build it locally and see if it really does what it says it does. |
|
cc @aldy505 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
This is working perfectly as expected. Here is my complete build / test procedure, please tell me if I was wrong in a step or I should've try something else. I upgraded and fixed https://aur.archlinux.org/packages/sentry-relay and created https://aur.archlinux.org/packages/sentry-relay-git (using my branch to build) and you can see commands which I used to build sentry-relay in it. You shouldn't use Anyway I created configuration using this command: Then I've setup a DNS server to see Then I tried enabling / disabling Perfect test would be to have Also I don't know if |
|
|
||
| impl Resolve for HickoryResolver { | ||
| fn resolve(&self, name: Name) -> Resolving { | ||
| let resolver = self.0.clone(); // cheap, TokioResolver is Arc-backed |
There was a problem hiding this comment.
Bug: The error handling for read_system_conf() uses .unwrap_or_default(), which falls back to the default resolver, contradicting the explicit goal of avoiding it.
Severity: MEDIUM
Suggested Fix
Instead of using .unwrap_or_default(), handle the potential error from read_system_conf() explicitly. Either log an error when it fails, propagate the error up the call stack, or use a fallback strategy that aligns with the intent to use system resolvers.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: relay-server/src/services/upstream.rs#L856
Potential issue: The code uses `read_system_conf().unwrap_or_default()`. If
`read_system_conf()` fails to read the system's DNS configuration, for instance in
certain containerized or isolated environments, the code will silently fall back to
`ResolverConfig::default()`. This behavior contradicts the stated intent in the commit
history, which was to explicitly avoid using the default resolver. This can lead to the
Relay silently using public DNS servers instead of the intended system resolvers,
causing DNS resolution issues that are difficult to debug.
There was a problem hiding this comment.
Yeah, I know, it's not good, but this is the default behvaiour of reqwest and it was doing the same thing, so I thought this should not get changed in this PR.
|
That's a lot of config/code for environments that don't need a DNS cache in the first place. I understand that this may solve the problem from the view of self hosted having problems with the cache, but why even cache at all for environments like docker(-compose)? Assuming this actually solves the users problem (I think there wasn't a confirmation yet). The DNS cache was put in place to solve a very specific problem in Kubernetes, which even that is no longer there for us (due to node local DNS caches). None of the other Sentry pods give this amount of flexibility and seemingly it's also not necessary for them. This is also something, if we offered it, which needs to be ported to other services like Symbolicator. |
I agree with each and every sentence of your comment, I couldn't put it better myself :) This is too much change for something we do not know if it actually fixes the problem. When I started to work on it, I didn't know how much change is going to be needed and this is definitely too much change, but I continued completing it to see what others think. That being said I'm closing this PR. |

Follow up on #5700 .
Fixes getsentry/sentry#109002 .
getsentry/self-hosted#4213 needs to be changed to add
dns_cache_nxdomain: falseafter this gets merged IMHO.Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.