Lagom gRPC Example

I am running Lagom scala gRPC example (https://github.com/lagom/lagom-samples) in a WSL-2 (Windows Subsystem Linux) and I am getting some errors on consuming the services.

the first curl example is fine:

but the second using the gRPC isn’t:

On Service:

Is the WSL the problem ? Any suggestions ?

Windows build version: 19041.508

Hi @VictorBLS,

I’m not familiar with WSL so I can’t tell if the problem is on that front. I would recommend you used this other samples instead: https://github.com/lagom/lagom-samples/tree/1.6.x/grpc-example/grpc-example-scala . The repository at https://github.com/lagom/lagom-scala-grpc-example was archived and that code was moved to a central repository with all the Lagom samples.

Also, because of changes in how the JVM handles protocol negotiation (which affects HTTP/2 and, therefore, gRPC), I would also recommend you use the latest JDK 8 (u252) or the latest JDK 11 (u8).

Cheers,

1 Like

Hi @ignasi35, thanks for the reply.
Seems like I am already using the https://github.com/lagom/lagom-samples.
To enforce it I check the commit hash on the given repository.
The old link was wrong and I replace it.
Sory for the mistake

I am also using the JDK 8 (u261) and it seems to be the latest one

Hi @VictorBLS @ignasi35
i am having the same issue when running on Ubuntu. However, the same code works on mac. Both have the same java version 1.8.0_261
How did you fix it ?
I am running the lagom grpc sample.
Request
curl http://localhost:9000/proxy/grpc-hello/Steve
Response

{"name":"io.grpc.StatusRuntimeException: UNAVAILABLE: io exception","detail":"io.grpc.StatusRuntimeException: UNAVAILABLE: io exception\n\tat io.grpc.Status.asRuntimeException(Status.java:533)\n\tat akka.grpc.internal.UnaryCallAdapter.onClose(UnaryCallAdapter.scala:40)\n\tat io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:413)\n\tat io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66)\n\tat io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742)\n\tat io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:721)\n\tat io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)\n\tat io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: ip-192-168-85-227/192.168.85.227:65499\nCaused by: java.net.ConnectException: finishConnect(..) failed: Connection refused\n\tat io.grpc.netty.shaded.io.netty.channel.unix.Errors.throwConnectException(Errors.java:124)\n\tat io.grpc.netty.shaded.io.netty.channel.unix.Socket.finishConnect(Socket.java:243)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:672)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:649)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:529)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:465)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)\n\tat io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)\n\tat io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.lang.Thread.run(Thread.java:748)\n"}

As i said, the sample works on Mac but not on ubuntu

I didn’t solve this yet. I’am using the http until I get any solution =/

The http is giving me the same issue.
curl http://localhost:9000/proxy/grpc-hello/Steve
Is returning the error.
I am following this repo https://developer.lightbend.com/guides/lagom-scala-grpc-example/
What link did you use ?

The link that I share above.
This commnad:

curl http://localhost:9000/proxy/grpc-hello/Steve

uses the gRPC protocol, if you want to use the http , use

curl http://localhost:9000/proxy/rest-hello/Alice

Thanks answering back.
My point is I am using the same link curl http://localhost:9000/proxy/grpc-hello/Steve and it is giving me this error on Ubuntu

{
  "name": "io.grpc.StatusRuntimeException: UNAVAILABLE: io exception",
  "detail": "io.grpc.StatusRuntimeException: UNAVAILABLE: io exception\n\tat io.grpc.Status.asRuntimeException(Status.java:533)\n\tat akka.grpc.internal.UnaryCallAdapter.onClose(UnaryCallAdapter.scala:40)\n\tat io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:413)\n\tat io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66)\n\tat io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742)\n\tat io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:721)\n\tat io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)\n\tat io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\nCaused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: ip-192-168-85-227/192.168.85.227:65499\nCaused by: java.net.ConnectException: finishConnect(..) failed: Connection refused\n\tat io.grpc.netty.shaded.io.netty.channel.unix.Errors.throwConnectException(Errors.java:124)\n\tat io.grpc.netty.shaded.io.netty.channel.unix.Socket.finishConnect(Socket.java:243)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:672)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:649)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:529)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:465)\n\tat io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)\n\tat io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)\n\tat io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\n"
}

Is it working for you ?

No, is not working =(

Did you try it on Linux or Mac ?
In my case, it is working on Mac, but not on Ubuntu

I try in windows and wsl-2 with linux 18LTS, both got the same error on gRPC comunication

Thanks @VictorBLS and @brabo-hi !

I’ve raised https://github.com/lagom/lagom-samples/issues/191 to continue discussing there. I think what we need now is a detailed description of the environments where the execution fails and where the execution passes. Details could include:

  1. commit SHA-1 in https://github.com/lagom/lagom-samples/
  2. project run (is it grpc-example-java or grpc-example-scala or both?)
  3. JDK version and vendor (Oracle, AdoptOpenJDK, Zulu, … 1.8_u262)
  4. sbt version
  5. OS version
  6. Other?

Thanks!

1 Like

@ignasi35, thanks to @johanandren help, I found the issue

  1. Since it’s in dev mod services are bound to localhost
[info] Service hello-impl listening for HTTP on 127.0.0.1:65499
[info] Service hello-impl listening for HTTPS on 127.0.0.1:11000
  1. However when running the sample it is calling the service using its external IP 192.168.85.227:65499. And as in my case I have a firewall, it rejected the connection.

As solution, I started the service by adding .settings(lagomServiceAddress := "0.0.0.0") to make it available from the outside.

2 Likes

@brabo-hi did work for you ?
In run with disabled firewall and got the same error. I am also check ip that the service call and seems to be the localhost as we can see in the attached pictures it is calling the right ip in my case =/.

Good information thanks for sharing
vmware

It is working for me, one solution I suggest you to try is to add to your service .settings(lagomServiceAddress := "0.0.0.0") to make it available externally

1 Like