Skip to content

fix(grpc): default to native dns resolver on macos#1125

Merged
sicoyle merged 2 commits into
dapr:mainfrom
sicoyle:samcoyle/pythonsdk-dns-ersolution
Jul 2, 2026
Merged

fix(grpc): default to native dns resolver on macos#1125
sicoyle merged 2 commits into
dapr:mainfrom
sicoyle:samcoyle/pythonsdk-dns-ersolution

Conversation

@sicoyle

@sicoyle sicoyle commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Signed-off-by: Samantha Coyle <sam@diagrid.io>
@sicoyle sicoyle requested a review from a team as a code owner July 2, 2026 20:46
Copilot AI review requested due to automatic review settings July 2, 2026 20:46
@sicoyle sicoyle requested a review from a team as a code owner July 2, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=native when 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.

Comment thread dapr/__init__.py Outdated
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.13%. Comparing base (bffb749) to head (b968b72).
⚠️ Report is 173 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Samantha Coyle <sam@diagrid.io>
@sicoyle sicoyle added this pull request to the merge queue Jul 2, 2026
Merged via the queue into dapr:main with commit 425681d Jul 2, 2026
18 of 19 checks passed
@sicoyle sicoyle deleted the samcoyle/pythonsdk-dns-ersolution branch July 2, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants