quarkus: Native gRPC Client is failing to send a message to GRPC server

Describe the bug

Native gRPC client is failing to send a message to gRPC server, this is the way to reproduce this problem and also I attached zip file which has both projects:

1- Copy grpc-plain-text-quickstart to grpc-plain-text-quickstart-client (a new project) 2- Remove HelloWorldEndpoint.java from the project grpc-plain-text-quickstart and build native 3- Remove HelloWorldService.java from the project grpc-plain-text-quickstart-client and build native 4- Run GRPC server grpc-plain-text-quickstart ( use different http port) 5- Run GRPC Client grpc-plain-text-quickstart-client 6- Use curl to trigger grpc client to talk to the grpc server : it is failing and I already posted these exceptions from GRPC server and GRPC client. 7- I used grpcurl to GRPC server is working .

This is an error in server side:

2023-01-05 17:51:05,143 SEVERE [io.grp.int.SerializingExecutor] (vert.x-eventloop-thread-0) Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1MessagesAvailable@2366db6e: io.grpc.StatusRuntimeException: INTERNAL: Invalid protobuf byte sequence
at io.grpc.Status.asRuntimeException(Status.java:526)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:218)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:118)
at io.grpc.MethodDescriptor.parseRequest(MethodDescriptor.java:307)
at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.messagesAvailableInternal(ServerCallImpl.java:330)
at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.messagesAvailable(ServerCallImpl.java:313)
at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1MessagesAvailable.runInContext(ServerImpl.java:834)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at io.vertx.grpc.VertxServer$ActualServer.lambda$null$0(VertxServer.java:91)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:246)
at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:43)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:833)
at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:704)
at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:202)
Caused by: com.google.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
at com.google.protobuf.CodedInputStream$ArrayDecoder.readTag(CodedInputStream.java:633)
at examples.HelloRequest.<init>(HelloRequest.java:46)
at examples.HelloRequest$1.parsePartialFrom(HelloRequest.java:499)
at examples.HelloRequest$1.parsePartialFrom(HelloRequest.java:495)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:86)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:48)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parseFrom(ProtoLiteUtils.java:223)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:215)
The client side :
2023-01-05 17:51:05,144 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /hello/blocking/World failed, error id: 6015b74f-8f6a-4953-a581-8251c378f79f-1: io.grpc.StatusRuntimeException: UNKNOWN
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 examples.GreeterGrpc$GreeterBlockingStub.sayHello(GreeterGrpc.java:147)
at io.quarkus.grpc.examples.hello.HelloWorldEndpoint.helloBlocking(HelloWorldEndpoint.java:25)
at io.quarkus.grpc.examples.hello.HelloWorldEndpoint$quarkusrestinvoker$helloBlocking_316ecf2888a019611a7fb9e55314f0a38542f3be.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:108)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:140)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:555)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base@11.0.17/java.lang.Thread.run(Thread.java:834)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)

grpc-client-problem.zip

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

Linux labdev75 3.10.0-1160.76.1.el7.x86_64 #1 SMP Tue Jul 26 14:15:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

11.0.17+10-LTS-jvmci-22.3-b07

GraalVM version (if different from Java)

GraalVM 22.3.0 Java 11 EE

Quarkus version or git rev

2.14.3

Build tool (ie. output of mvnw --version or gradlew --version)

apache-maven-3.6.3

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 32 (15 by maintainers)

Commits related to this issue

Most upvoted comments

What fix would you propose? We really want to initialize a maximum of gRPC at build time.

Our usual recommendation would be to initialize the class at runtime, but if you really want to initialize it at build time, you’ll need a substitution to recompute the correct values of the static fields. You can look at the Target_sun_misc_Unsafe substitution as an example of how to do that.