fix(grpc): default to native dns resolver on macos#1125
Merged
Conversation
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve out-of-the-box gRPC connectivity reliability on macOS by defaulting gRPC’s DNS resolver to the OS-native resolver (via the GRPC_DNS_RESOLVER environment variable), while leaving behavior unchanged on other platforms.
Changes:
- Add macOS-only import-time defaulting of
GRPC_DNS_RESOLVER=nativewhen the variable is not already set. - Introduce unit tests validating darwin vs non-darwin behavior and preservation of explicitly configured resolver values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
dapr/__init__.py |
Sets GRPC_DNS_RESOLVER to native on macOS (when unset) during import dapr. |
tests/test_grpc_dns_resolver_default.py |
Adds unit tests for the new macOS DNS resolver defaulting behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1125 +/- ##
==========================================
- Coverage 86.63% 82.13% -4.50%
==========================================
Files 84 116 +32
Lines 4473 9609 +5136
==========================================
+ Hits 3875 7892 +4017
- Misses 598 1717 +1119 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Samantha Coyle <sam@diagrid.io>
CasperGN
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
grpc's bundled c-ares resolver frequently ignores macos dns config, cancelling lookups that resolve fine system-wide and failing with
StatusCode.UNAVAILABLE"DNS query cancelled", even for reachable endpoints. Defferring to the os resolver (getaddrinfo on mac) fixes it, so mac users get reliable connectivity out of the box without setting an env var for this.only changes for mac, not windows or linux.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: