Skip to content

Name Resolver Bridge Listener Handling #12444

@oliviamariacodes

Description

@oliviamariacodes

Fix for Issue:

This issue is fixed in this PR for review

What version of gRPC-Java are you using?

Attempting an upgrade from v1.63.3 to v1.75.0

What is your environment?

N/A. Relevant for Java application with custom NameResolver implementation using Listener interface (not Listener2)

What did you expect to see?

When a DNS resolution fails for a non-existent target, I expected the error to be properly handled and propagated through the NameResolver.Listener.onError() callback, allowing the application to handle the error gracefully.

What did you see instead?

This results in an uncaught exception in the SynchronizationContext:

  [Channel<8>: (dns:///not-a-real-address)] Uncaught exception in the SynchronizationContext. Panic!
  java.lang.IllegalStateException: No value present.

A similar issue can replicated through startOnOldListener_resolverReportsError test in this PR.
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.

This issue affects custom NameResolver implementations still using the Listener interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions