xds icon indicating copy to clipboard operation
xds copied to clipboard

Facing "NameResolver returned no usable address" error

Open deepu-james opened this issue 1 month ago • 8 comments

I am facing the below error when trying to hit a server from another one. The client and server are spring boot based Java applications.

io.grpc.StatusRuntimeException: UNAVAILABLE: NameResolver returned no usable address. addrs=[], attrs={io.grpc.xds.InternalXdsAttributes.callCounterProvider=io.grpc.xds.SharedCallCounterMap@1657448d, io.grpc.xds.InternalXdsAttributes.xdsClientPool=io.grpc.xds.SharedXdsClientPoolProvider$RefCountedXdsClientObjectPool@2c5733e7, io.grpc.internal.RetryingNameResolver.RESOLUTION_RESULT_LISTENER_KEY=io.grpc.internal.RetryingNameResolver$ResolutionResultListener@18c7636}
	at io.grpc.StatusRuntimeException.fillInStackTrace(StatusRuntimeException.java:68)
	at io.grpc.StatusRuntimeException.<init>(StatusRuntimeException.java:58)
	at io.grpc.StatusRuntimeException.<init>(StatusRuntimeException.java:50)
	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
	at com.verteil.air.v3.offer.OfferManagementServiceGrpc$OfferManagementServiceBlockingStub.reshopOrder(OfferManagementServiceGrpc.java:298)
	at com.verteil.offermanagement.client.connector.OfferConnectorClientImpl.reshopOrder(OfferConnectorClientImpl.java:39)
	at com.verteil.offermanagement.service.impl.OfferServiceImpl.reshopOrder(OfferServiceImpl.java:165)
	at com.verteil.offermanagement.api.OfferManagementV3Api.reshopOrder(OfferManagementV3Api.java:48)
	at com.verteil.offermanagement.api.OfferManagementV3Api$$FastClassBySpringCGLIB$$69608825.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
	at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:49)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
	at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:58)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
	at com.verteil.offermanagement.api.OfferManagementV3Api$$EnhancerBySpringCGLIB$$14246d62.reshopOrder(<generated>)
	at com.verteil.air.v3.offer.OfferManagementServiceGrpc$MethodHandlers.invoke(OfferManagementServiceGrpc.java:392)
	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
	at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
	at io.grpc.Contexts$ContextualizedServerCallListener.onHalfClose(Contexts.java:86)
	at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
	at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:351)
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:861)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:858)

The changes I made to the app are:

  • configured ManagedChannel creation like this:
Grpc
        .newChannelBuilder("xds://<app_name>.<namespace>:<app_port>", InsecureChannelCredentials.create())
        .maxInboundMessageSize(20 * 1024 * 1024)
        .build();
  • configured client's startup as -Dio.grpc.xds.bootstrap=/opt/xds_bootstrap_config.json. The contents of the config json file being:
{
  "xds_servers": [
    {
      "server_uri": "xds-server:5000",
      "channel_creds": [
        {
          "type": "insecure"
        }
      ],
      "server_features": [
        "xds_v3"
      ]
    }
  ],
  "node": {
    "id": "anything",
    "locality": {
      "zone": "k8s"
    }
  }
}

What could be the possible reasons for this failure? How can I debug such issues?

deepu-james avatar Jan 03 '25 08:01 deepu-james