Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS can omit URIs which results in confusing errors for services created with a single node. #2265

Open
felixdesouza opened this issue May 2, 2024 · 0 comments

Comments

@felixdesouza
Copy link

What happened?

An internal service created a client for a single node via DialogueClients.create(interface, clientConfiguration) where clientConfiguration has a single configured URI. They had validation to make sure that they would only ever pass in a single node to the ClientConfiguration. However, they ended up seeing errors like:

com.palantir.logsafe.exceptions.SafeIllegalStateException: There are no URIs configured to handle requests
	at com.palantir.dialogue.core.ZeroUriNodeSelectionChannel.maybeExecute(ZeroUriNodeSelectionChannel.java:44)
...

Arguably they can probably use the perHost feature in #2192 but that's relatively new here.

Tracing through:

  • DialogueClients#create(Class<T> clientInterface, ClientConfiguration clientConfiguration) -> LegacyConstruction#getNonReloading(Class<T> clientInterface, ClientConfiguration clientConfiguration)
  • LegacyConstruction#getNonReloading(Class<T> clientInterface, ClientConfiguration clientConfiguration) uses ReloadingFactory configured with an empty reloadable block:
    private static final ReloadingFactory FACTORY = DialogueClients.create(
    Refreshable.only(ServicesConfigBlock.empty()))
    .withHostEventsSink(NoOpHostEventsSink.INSTANCE);
  • ReloadingClientFactory#getNonReloading -> ReloadingClientFactory#getNonReloadingChannel
  • ReloadingClientFactory#getNonReloadingChannel underneath uses a LiveReloadingChannel that's configured to poll for DNS changes in the background via DnsSupport.
  • LiveReloadingChannel takes in a Refreshable<DnsResolutionResults<ServiceConfiguration>> and instead of the URIs flowing from the clientConfiguration, they instead flow from the DnsResolutionResults via getTargetUris.
  • going inside getTargetUris, the only way to get an empty set of URIs is to have DNS enabled and have no parse errors.
  • DialogueChannel by default uses the uris from the clientConfiguration, but if you do specify uris it uses that. So if you resolve nothing, you will have no uris.

What did you want to happen?

If I can't connect, fail with a more familiar exception i.e. ConnectException or UnknownHostException.

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

No branches or pull requests

1 participant