quarkus
quarkus copied to clipboard
gRPC Server not reachable
Describe the bug
Hello I'm testing Quarkus gRPC on Windows 11 64 Bit Version. Latest Quarkus: 3.9.4
that's my proto file:
syntax = "proto3";
package tutorial;
option java_package = "com.example.quarkus.grpc";
service ProductsService {
rpc GetProduct(ProductRequest) returns (ProductResponse) {}
}
message ProductRequest {
string productId = 1;
}
message ProductResponse {
string id = 1;
string name = 2;
uint32 priceCents = 3;
bool orderable = 4;
}
That's my gRPC Service:
package grpc
import com.example.quarkus.grpc.Products
import com.example.quarkus.grpc.Products.ProductResponse
import com.example.quarkus.grpc.ProductsService
import io.quarkus.grpc.GrpcService
import io.smallrye.mutiny.Uni
@GrpcService
class MutinyProductService : ProductsService {
val productsMap = LinkedHashMap<String, Uni<Products>>()
override fun getProduct(request: Products.ProductRequest): Uni<ProductResponse> {
return Uni.createFrom().item {
ProductResponse.newBuilder()
.apply {
id = request.productId
name = "Shoe"
priceCents = 1234
orderable = true
}.build()
}
}
}
my application.properties:
quarkus.grpc.server.use-separate-server=false
quarkus.grpc.server.enable-reflection-service=true
It doesn't matter if I use Java or Kotlin. I've got with both languages the same error.
Of course I tried multiple application settings like host, port or "quarkus.index-dependency.grpc.group-id" etc..
Neither Postman recognize the proto definition file nor if I trigger via http://localhost:8080/q/dev-ui/io.quarkus.quarkus-grpc/services
I get following error:
Previous channel ManagedChannelImpl{logId=1, target=localhost:8080} was garbage collected without being shut down! ~*~*~*
Make sure to call shutdown()/shutdownNow(): java.lang.RuntimeException: ManagedChannel allocation site
at io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.<init>(ManagedChannelOrphanWrapper.java:102)
at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:60)
at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:51)
at io.grpc.internal.ManagedChannelImplBuilder.build(ManagedChannelImplBuilder.java:672)
at io.grpc.ForwardingChannelBuilder2.build(ForwardingChannelBuilder2.java:260)
at io.quarkus.grpc.deployment.devui.GrpcDevUIProcessor.getChannel(GrpcDevUIProcessor.java:338)
at io.quarkus.grpc.deployment.devui.GrpcDevUIProcessor.createStub(GrpcDevUIProcessor.java:327)
at io.quarkus.grpc.deployment.devui.GrpcDevUIProcessor.grpcAction(GrpcDevUIProcessor.java:270)
at io.quarkus.grpc.deployment.devui.GrpcDevUIProcessor.lambda$pages$0(GrpcDevUIProcessor.java:205)
at io.quarkus.dev.console.DevConsoleManager.invoke(DevConsoleManager.java:135)
at io.quarkus.grpc.runtime.devui.GrpcJsonRPCService.streamService(GrpcJsonRPCService.java:110)
at io.quarkus.grpc.runtime.devui.GrpcJsonRPCService.testService(GrpcJsonRPCService.java:99)
at io.quarkus.grpc.runtime.devui.GrpcJsonRPCService_ClientProxy.testService(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.devui.runtime.comms.JsonRpcRouter.invoke(JsonRpcRouter.java:89)
at io.quarkus.devui.runtime.comms.JsonRpcRouter.route(JsonRpcRouter.java:189)
at io.quarkus.devui.runtime.comms.JsonRpcRouter.lambda$addSocket$1(JsonRpcRouter.java:112)
at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handleTextFrame(WebSocketImplBase.java:634)
at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handle(WebSocketImplBase.java:600)
at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handle(WebSocketImplBase.java:589)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:279)
at io.vertx.core.http.impl.WebSocketImplBase.receiveFrame(WebSocketImplBase.java:534)
at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:255)
at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:134)
at io.vertx.core.http.impl.WebSocketImplBase.handleFrame(WebSocketImplBase.java:475)
at io.vertx.core.impl.ContextImpl.execute(ContextImpl.java:313)
at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:161)
at io.vertx.core.http.impl.Http1xConnectionBase.handleWsFrame(Http1xConnectionBase.java:66)
at io.vertx.core.http.impl.Http1xServerConnection.handleOther(Http1xServerConnection.java:191)
at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:176)
at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:159)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:289)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
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.base/java.lang.Thread.run(Thread.java:833)
Quarkus-Server is up and running without problems:
2024-04-24 14:42:49,070 INFO [io.qua.grp.run.GrpcServerRecorder] (Quarkus Main Thread) Registering gRPC reflection service
2024-04-24 14:42:49,108 INFO [io.qua.grp.run.GrpcServerRecorder] (Quarkus Main Thread) Starting new Quarkus gRPC server (using Vert.x transport)...
2024-04-24 14:42:49,166 INFO [io.qua.boo.run.Timing] (Quarkus Main Thread) kotlin_grpc 1.0-SNAPSHOT on JVM (powered by Quarkus 3.9.4) started in 1.480s. Listening on: http://localhost:8080/
2024-04-24 14:42:49,168 INFO [io.qua.boo.run.Timing] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2024-04-24 14:42:49,169 INFO [io.qua.boo.run.Timing] (Quarkus Main Thread) Installed features: [cdi, grpc-server, kotlin, rest, rest-jackson, smallrye-context-propagation, vertx]
Expected behavior
Reachable gRPC service.
Actual behavior
Error message as you can read top.
How to Reproduce?
No response
Output of uname -a or ver
No response
Output of java -version
17
Quarkus version or git rev
3.9.4
Build tool (ie. output of mvnw --version or gradlew --version)
Gradle 8.6
Additional information
No response
/cc @alesj (grpc), @cescoffier (grpc), @geoand (kotlin)
Can you provide a reproducer?
@cescoffier https://github.com/EE1234EE/kotlin_grpc.git is that reproducer legit?
Works as expected:
> grpcurl -plaintext -d '{"productId": "0"}' localhost:8080 tutorial.ProductsService/GetProduct
{
"name": "Shoe",
"priceCents": 1234,
"orderable": true
}
Same from Postman:
OK so it seems a problem on my PC... Thanks for clarifying. I'll dig into it.
Thank you very much for your time! :)
Ok so I figured it out, on windows no matter what I do, postman do not read my proto files. But that's fine for me. So grpcurl installed and than i have to trigger the grpcurl calls via Windows PowerShell, command line is not sufficient. And another hint for windows users, this Stackoverflow post helped. I'm not sure why "/q/dev-ui/io.quarkus.quarkus-grpc/services" is not working, only error message I can see on console is:
Uncaught (in promise) TypeError: this._responseTextArea(...).populatePrettyJson is not a function
at qwc-grpc-services.js:285:62
The dev ui problem seems to be a bug. @phillip-kruger can you have a look?
The Dev UI problem is already fixed in main
See https://github.com/quarkusio/quarkus/pull/40176
Thanks @phillip-kruger !