How gRPC should be configured to be used with GAE Standard Java 8?

541 views
Skip to first unread message

dmitry....@teamdev.com

unread,
Sep 25, 2017, 7:54:57 AM9/25/17
to grpc.io

I am configuring gRPC according to the answer, which says: "Using gRPC with GAE Java 8 doesn't need anything special.".

A gRPC server is started and deployed on a GAE Standard environment for Java 8:

-----------------------------------------------------------------------------------------------------------------------------------------
MyGrpcService service = ...
NettyServerBuilder.forPort(50051).addService(service).build();
-----------------------------------------------------------------------------------------------------------------------------------------

A client uses a service with the ManagedChannel:

-----------------------------------------------------------------------------------------------------------------------------------------
ManagedChannel channel = NettyChannelBuilder.forAddress("my-project.appspot.com", 50051)
                                                                               .usePlaintext(true)
                                                                               .build();
MyGrpcService.newBlockingStub(channel);
-----------------------------------------------------------------------------------------------------------------------------------------

What am I doing wrong? The call to the service has the following result:

-----------------------------------------------------------------------------------------------------------------------------------------
Exception in thread "main" io.grpc.StatusRuntimeException: UNAVAILABLE
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:210)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:191)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:124)
at io.spine.client.grpc.QueryServiceGrpc$QueryServiceBlockingStub.read(QueryServiceGrpc.java:159)
at io.spine.examples.todolist.client.CommandLineTodoClient.getMyListView(CommandLineTodoClient.java:189)
at io.spine.examples.todolist.view.MyTasksListView.render(MyTasksListView.java:68)
at io.spine.cli.AbstractScreen.renderView(AbstractScreen.java:63)
at io.spine.cli.action.TransitionAction.execute(TransitionAction.java:51)
at io.spine.cli.view.AbstractView.executeAction(AbstractView.java:108)
at io.spine.cli.view.AbstractView.render(AbstractView.java:92)
at io.spine.cli.AbstractScreen.renderView(AbstractScreen.java:63)
at io.spine.cli.action.TransitionAction.execute(TransitionAction.java:51)
at io.spine.cli.view.AbstractView.executeAction(AbstractView.java:108)
at io.spine.cli.view.AbstractView.render(AbstractView.java:92)
at io.spine.cli.AbstractScreen.renderView(AbstractScreen.java:63)
at io.spine.examples.todolist.ClientApplication.run(ClientApplication.java:52)
at io.spine.examples.todolist.GaeClient.main(GaeClient.java:39)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: spine-dev.appspot.com/216.58.209.84:50051
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:352)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:633)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection timed out: no further information
... 11 more
-----------------------------------------------------------------------------------------------------------------------------------------

Kun Zhang

unread,
Sep 25, 2017, 2:01:53 PM9/25/17
to grpc.io
Have you confirmed that this address is indeed connectable, e.g., allowed by firewall?

dmitry....@teamdev.com

unread,
Sep 26, 2017, 4:00:09 AM9/26/17
to grpc.io
I can successfully access servlets using this address, firewall rules - allow full range of IPs.

Should i configure a host name in `NettyServerBuilder` explicitly?

Spencer Fang

unread,
Sep 28, 2017, 5:18:42 PM9/28/17
to dmitry....@teamdev.com, grpc.io
GAE apps that expose a gRPC service is not supported at this time, but they can be clients that talk to gRPC services. I think there may have been some miscommunication in the original thread. I found some information about hosting gRPC services in Google Compute Engine, which may be a possible alternative for you:


--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b57053e6-ad34-4ac4-bb4c-f173b7ef18e6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Spencer Fang
Reply all
Reply to author
Forward
0 new messages