• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #20032
89%

Build:
DEFAULT BRANCH: master
Ran 29 Oct 2025 09:08AM UTC
Jobs 1
Files 621
Run time 8min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Oct 2025 08:58AM UTC coverage: 88.561% (-0.03%) from 88.586%
#20032

push

github

web-flow
api: Fix name resolver bridge listener handling for address resolution errors (#12441)

Fixes https://github.com/grpc/grpc-java/issues/12444

This PR addresses a bug in the `NameResolver.Listener` to
`NameResolver.Listener2` bridge affecting custom NameResolver
implementations using Listener.

The bridge in `NameResolver.start(Listener)` at
https://github.com/grpc/grpc-java/blob/master/api/src/main/java/io/grpc/NameResolver.java#L100
unconditionally calls `getValue()` on the `StatusOr`, throwing
`java.lang.IllegalStateException: No value present.` when the result
contains an error.

This was identified when upgrading from gRPC `v1.63.3` to `v1.75.0`. 

The bug occurs due to `DnsNameResolver`'s error handling changes between
versions:

- `v1.63.3`: Errors reported via `Listener.onError()`
(https://github.com/grpc/grpc-java/blob/v1.63.x/core/src/main/java/io/grpc/internal/DnsNameResolver.java#L319)
- `v1.75.0`: Errors passed via `Listener2.onResult2()` with a
ResolutionResult containing either addresses OR an error
(https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/DnsNameResolver.java#L322)

This PR updates the bridge to check whether `ResolutionResult` contains
addresses or an error. It passes the error via `onError` and addresses
via `onAddresses`.

**Reproducing the Issue**
The `startOnOldListener_resolverReportsError` test reproduces a similar
issue. It creates a custom `NameResolver` that reports errors through
the `ResolutionResult` like the `DNSNameResolver` in `v1.75.0`, passes
an old Listener to `resolver.start`, which triggers the bridge code
path.

Without the fix, the bridge calls `getValue()` on the error containing
`StatusOr`, throwing `IllegalStateException: No value present`.

With the fix, the bridge checks `hasValue()` first and correctly routes
to `listener.onError()` when appropriate. This ensures backward
compatibility for `Listener` implementations when resolvers report
errors via `ResolutionResult`.

34941 of 39454 relevant lines covered (88.56%)

0.89 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
96.55
-0.57% ../core/src/main/java/io/grpc/internal/DelayedClientTransport.java
2
81.05
0.0% ../okhttp/src/main/java/io/grpc/okhttp/ExceptionHandlingFrameWriter.java
3
92.89
-0.42% ../okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java
5
69.83
-4.31% ../servlet/src/main/java/io/grpc/servlet/ServletServerStream.java
6
79.03
-4.84% ../servlet/src/main/java/io/grpc/servlet/ServletAdapter.java
30
79.37
0.45% ../api/src/main/java/io/grpc/NameResolver.java
Jobs
ID Job ID Ran Files Coverage
1 #20032.1 29 Oct 2025 09:08AM UTC 621
88.56
Source Files on build #20032
  • Tree
  • List 621
  • Changed 9
  • Source Changed 0
  • Coverage Changed 9
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #20032
  • acbbf869 on github
  • Prev Build on master
  • Next Build on master
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc