[grpc-java] NameResolver changes in 1.1.1 ?

62 views
Skip to first unread message

Jorg Heymans

unread,
Feb 7, 2017, 9:27:03 AM2/7/17
to grpc.io
Hi,

After updating to grpc 1.1.1 it seems that the semantics around using NameResolver have changed. Basically in our (working) 1.0.3 NameResolver implementation we were doing this in start() :

      Collection<ServiceInstance> serviceInstances = provider.getAllInstances(); // provider is a curator.ServiceProvider
      List<ResolvedServerInfo> infoGroups = new ArrayList<>();
      for (ServiceInstance serviceInstance : serviceInstances) {
        infoGroups.add(new ResolvedServerInfo(
            InetSocketAddress.createUnresolved(serviceInstance.getAddress(), serviceInstance.getPort()),
            Attributes.EMPTY));
      }
      listener.onUpdate(Collections.singletonList(infoGroups), Attributes.EMPTY);

For 1.1.1 we had to slightly change it to match the listener.onUpdate signature change:

      Collection<ServiceInstance> serviceInstances = provider.getAllInstances();
      List<ResolvedServerInfo> serverInfos = new ArrayList<>();
      for (ServiceInstance serviceInstance : serviceInstances) {
        serverInfos.add(new ResolvedServerInfo(
            InetSocketAddress.createUnresolved(serviceInstance.getAddress(), serviceInstance.getPort())));
      }
      listener.onUpdate(Collections.singletonList(ResolvedServerInfoGroup.builder().addAll(serverInfos).build()),
          Attributes.EMPTY);

However when our client now tries to connect to the server we get an exception indicating the channel is not active. 

io.grpc.StatusRuntimeException: UNAVAILABLE: Channel in TRANSIENT_FAILURE state
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:227)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:208)

Any thoughts what could be going on here ?

Thanks,
Jorg




Kun Zhang

unread,
Feb 8, 2017, 12:14:19 PM2/8/17
to grpc.io
We should have mentioned the signature change in our release note. Sorry about that.

The error doesn't seem to be related to the signature change. The message is logged from here, which indicates that the connect attempt has failed. If you turn on FINE logging, you may find something useful.

Jorg Heymans

unread,
Feb 10, 2017, 8:12:28 AM2/10/17
to grpc.io
Indeed the logging revealed in fact an unrelated error during SSL init, thanks for the hint.

Jorg

Reply all
Reply to author
Forward
0 new messages