Give the Android emulator fixed DNS servers - #1866
Open
Ewerton Scaboro da Silva (ewertons) wants to merge 2 commits into
Open
Give the Android emulator fixed DNS servers#1866Ewerton Scaboro da Silva (ewertons) wants to merge 2 commits into
Ewerton Scaboro da Silva (ewertons) wants to merge 2 commits into
Conversation
The Android test jobs intermittently fail with java.net.UnknownHostException: Unable to resolve host "javasdkgate<random>-dps.azure-devices-provisioning.net": No address associated with hostname thrown from the first HTTPS call the test makes. It is not deterministic: in the same emulator run, some tests resolve that hostname successfully while others fail on it, and the number of affected tests varies from run to run. The emulator was started without -dns-server, so the guest resolves through the emulator's DNS proxy, which forwards to whatever resolvers the host agent has. Pointing the guest at fixed public resolvers takes the host's resolver configuration out of the picture. Also logs a single name resolution check after boot, so that a later DNS failure can be told apart from an emulator that never had working name resolution. That check only logs and cannot fail the task. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Ewerton Scaboro da Silva (ewertons)
August 25, 2026 21:41
View session
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce intermittent Android emulator test flakes caused by nondeterministic DNS resolution inside the emulator by explicitly configuring DNS servers at emulator startup and adding a lightweight, non-fatal post-boot resolution check for diagnostics.
Changes:
- Start the Android emulator with explicit DNS servers (
-dns-server 8.8.8.8,8.8.4.4) to avoid dependence on the host agent’s resolver configuration. - Add an
adb shellname-resolution check after boot to help distinguish later DNS flakes from an emulator that never had working resolution.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ping also fails when ICMP is not allowed out, which is common and harmless on these agents, so its exit status cannot stand in for a DNS verdict. Inspect the output for the resolution failure signatures instead, and say explicitly when a ping failure was reachability rather than name resolution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Android test jobs intermittently fail with:
thrown from the first HTTPS call, before any SDK logic runs.
Why it is the emulator's DNS
StartEmulator.shstarted the emulator without-dns-server, so the guest resolves through the emulator's DNS proxy, which forwards to whatever resolvers the host agent has.It is not deterministic. In build 162434, 5 of 17 tests in
TestGroup1failed on that hostname while the other 12 — which reach the same host throughProvisioningCommon— passed in the same emulator process. A missing or misdeployed resource would fail all 17.Recent
Android Test TestGroup1failures, all the same exception:main4 of the last 39 Android builds (~10%), across
mainand unrelated PRs.DeployCloudTestResourcessucceeded in every one.Change
-dns-server 8.8.8.8,8.8.4.4on emulator start, so the guest does not depend on the host agent's resolver configuration.Verification
bash -n: clean.Given the ~10% base rate, one green run will not prove this fixed. Several consecutive green Android runs would.