vert-x3 / vertx-grpc

gRPC for Vert.x
78 stars 49 forks source link

LoadBalancer2.Factory ClassNotFoundException #7

Open jgarcia241 opened 7 years ago

jgarcia241 commented 7 years ago

Hi,

I'm using version 3.4.1 and it is failing to make calls, because it cannot find the class LoadBalancer2.Factory, when creating a VertxChannelBuilder

Looking to latest code, looks that in master branch we no longer have the method loadBalancerFactory with that signature( that accepts thatLoadBalancer2.Factory)

Is this a bug ? or am I missing any library in my project?

Kind regards

vietj commented 7 years ago

we have upgraded the master version to the latest gRPC version.

VertxChannelBuilder extends ManagedChannelBuilder which only defines:

public abstract T loadBalancerFactory(io.grpc.LoadBalancer.Factory var1);

So we provide nothing more and nothing less than what the original API provides.

jgarcia241 commented 7 years ago

Yep. I saw that on master it was correct.

I'm now including a gradle dependency like: compile "io.vertx:vertx-grpc:3.4.1"

Is it released or should I manually build and include the jar?

vietj commented 7 years ago

the current 3.4.2 release is staging here : https://oss.sonatype.org/content/repositories/iovertx-3685/ you can follow on vertx-dev the release if you like

jgarcia241 commented 7 years ago

Almost there!

If I include the vertx-grpc from that maven repo, my add does not startup anymore, as it complains about Netty and Dropmetrics when creating my redis client.- I guess some interface have changed.

If I manually include the vertx-grpc-3-42-jar file in my app , I get the following error on the server:

15:20:24.933 [vert.x-eventloop-thread-10] DEBUG io.grpc.netty.NettyServerHandler - 
----------------OUTBOUND--------------------
[id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] SETTINGS: ack=false, settings={MAX_CONCURRENT_STREAMS=2147483647, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=8192}
------------------------------------
15:20:24.934 [vert.x-eventloop-thread-10] DEBUG io.grpc.netty.NettyServerHandler - 
----------------OUTBOUND--------------------
[id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] WINDOW_UPDATE: streamId=0, windowSizeIncrement=983041
------------------------------------
15:20:24.934 [vert.x-eventloop-thread-10] DEBUG io.grpc.netty.NettyServerHandler - 
----------------INBOUND--------------------
[id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] SETTINGS: ack=false, settings={ENABLE_PUSH=0, MAX_CONCURRENT_STREAMS=0, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=8192}
------------------------------------
15:20:24.934 [vert.x-eventloop-thread-10] DEBUG io.grpc.netty.NettyServerHandler - 
----------------OUTBOUND--------------------
[id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] SETTINGS: ack=true
------------------------------------
15:20:24.934 [vert.x-eventloop-thread-10] DEBUG io.grpc.netty.NettyServerHandler - 
----------------INBOUND--------------------
[id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] WINDOW_UPDATE: streamId=0, windowSizeIncrement=983041
------------------------------------
15:20:24.935 [vert.x-eventloop-thread-10] DEBUG io.grpc.netty.NettyServerHandler - 
----------------INBOUND--------------------
[id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] SETTINGS: ack=true
------------------------------------
15:20:24.936 [vert.x-eventloop-thread-10] DEBUG io.grpc.netty.NettyServerHandler - 
----------------INBOUND--------------------
[id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] HEADERS: streamId=3, headers=GrpcHttp2RequestHeaders[:path: /EchoService/SayEcho, :authority: localhost:2410, :method: POST, :scheme: http, te: trailers, content-type: application/grpc, user-agent: grpc-java-netty/1.3.0, grpc-accept-encoding: gzip], streamDependency=0, weight=16, exclusive=false, padding=0, endStream=false
------------------------------------
2017-06-15 15:20:24.937 WARNING [io.grpc.netty.NettyServerHandler] Exception in onHeadersRead()
java.lang.NullPointerException
        at io.vertx.grpc.VertxServer$ActualServer.lambda$new$0(VertxServer.java:61)
        at io.grpc.internal.SerializingExecutor.schedule(SerializingExecutor.java:87)
        at io.grpc.internal.SerializingExecutor.execute(SerializingExecutor.java:80)
        at io.grpc.internal.ServerImpl$ServerTransportListenerImpl.streamCreated(ServerImpl.java:400)
        at io.grpc.netty.NettyServerHandler.onHeadersRead(NettyServerHandler.java:317)
        at io.grpc.netty.NettyServerHandler.access$500(NettyServerHandler.java:102)
        at io.grpc.netty.NettyServerHandler$FrameListener.onHeadersRead(NettyServerHandler.java:614)
        at io.grpc.netty.FixedHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(FixedHttp2ConnectionDecoder.java:320)
        at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onHeadersRead(Http2InboundFrameLogger.java:65)
        at io.netty.handler.codec.http2.DefaultHttp2FrameReader$1.processFragment(DefaultHttp2FrameReader.java:461)
        at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:468)
        at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:253)
        at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160)
        at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
        at io.grpc.netty.FixedHttp2ConnectionDecoder.decodeFrame(FixedHttp2ConnectionDecoder.java:119)
        at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:341)
        at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:401)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:642)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:565)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:479)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:441)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
        at java.lang.Thread.run(Thread.java:745)

2017-06-15 15:20:24.938 WARNING [io.grpc.netty.NettyServerHandler] Connection Error
java.lang.NullPointerException

15:20:24.938 [vert.x-eventloop-thread-10] DEBUG io.grpc.netty.NettyServerHandler - 
----------------OUTBOUND--------------------
[id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] GO_AWAY: lastStreamId=3, errorCode=2, length=0, bytes=
------------------------------------
15:20:24.938 [vert.x-eventloop-thread-10] DEBUG i.n.h.c.http2.Http2ConnectionHandler - [id: 0x1b7b6153, L:/127.0.0.1:2410 - R:/127.0.0.1:49687] Sent GOAWAY: lastStreamId '3', errorCode '2', debugData ''. Forcing shutdown of the connection.
2017-06-15 15:20:24.938 SEVERE  [io.grpc.netty.NettyServerTransport] Transport failed
java.lang.NullPointerException

Upgrading all the app to use 3.4.2 from that staging repo, also makes the startup to fail.

Any clue?

jgarcia241 commented 7 years ago

BTW, I tried with gRPC 1.1.2 and 1.3.0 and I get the same error (different lines in jetty files, but kind of the same error)

Thanks

jgarcia241 commented 7 years ago

So, after tons of testings, I think I found the issue.

If I deploy the verticle that contains the server as a normal verticle, using(vertx.deployVerticle(new Server()) it works fine.

However, if I deploy the verticle as a service vertx.deployVerticle("service:my-descriptor.json") (with the service json descriptor) , then it fails with the error above, when I call it.

Should we pass this to the vertx-service subproject?

vietj commented 7 years ago

could you write a reproducer and link it to this issue for now ?

jgarcia241 commented 7 years ago

gprc-service.zip

Find attached an example with 2 launcher, as service and not as service. Hope this helps

vietj commented 6 years ago

can you try with the latest 3.5.1 SNAPSHOT ?

jgarcia241 commented 6 years ago

Looks it still does not work if deployed as a service. This is the stack trace I get:

gRPC service started
Mar 07, 2018 11:18:40 AM io.grpc.netty.NettyServerHandler onHeadersRead
WARNING: Exception in onHeadersRead()
java.lang.NullPointerException
    at io.vertx.grpc.VertxServer$ActualServer.lambda$new$0(VertxServer.java:70)
    at io.grpc.internal.SerializingExecutor.schedule(SerializingExecutor.java:93)
    at io.grpc.internal.SerializingExecutor.execute(SerializingExecutor.java:86)
    at io.grpc.internal.ServerImpl$ServerTransportListenerImpl.streamCreated(ServerImpl.java:477)
    at io.grpc.netty.NettyServerHandler.onHeadersRead(NettyServerHandler.java:448)
    at io.grpc.netty.NettyServerHandler.access$800(NettyServerHandler.java:97)
    at io.grpc.netty.NettyServerHandler$FrameListener.onHeadersRead(NettyServerHandler.java:745)
    at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:321)
    at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onHeadersRead(Http2InboundFrameLogger.java:65)
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader$1.processFragment(DefaultHttp2FrameReader.java:457)
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:464)
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:254)
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160)
    at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
    at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:118)
    at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:390)
    at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:450)
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:141)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
    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:886)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:745)

Mar 07, 2018 11:18:40 AM io.grpc.netty.NettyServerTransport notifyTerminated
INFO: Transport failed
java.lang.NullPointerException
    at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
    at java.util.regex.Matcher.reset(Matcher.java:309)
    at java.util.regex.Matcher.<init>(Matcher.java:229)
    at java.util.regex.Pattern.matcher(Pattern.java:1093)
    at java.util.Formatter.parse(Formatter.java:2547)
    at java.util.Formatter.format(Formatter.java:2501)
    at java.util.Formatter.format(Formatter.java:2455)
    at java.lang.String.format(String.java:2940)
    at io.netty.handler.codec.http2.Http2Exception.streamError(Http2Exception.java:149)
    at io.grpc.netty.NettyServerHandler.newStreamException(NettyServerHandler.java:706)
    at io.grpc.netty.NettyServerHandler.onHeadersRead(NettyServerHandler.java:454)
    at io.grpc.netty.NettyServerHandler.access$800(NettyServerHandler.java:97)
    at io.grpc.netty.NettyServerHandler$FrameListener.onHeadersRead(NettyServerHandler.java:745)
    at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:321)
    at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onHeadersRead(Http2InboundFrameLogger.java:65)
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader$1.processFragment(DefaultHttp2FrameReader.java:457)
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:464)
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:254)
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160)
    at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
    at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:118)
    at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:390)
    at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:450)
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:141)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
    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:886)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:745)

io.grpc.StatusRuntimeException: INTERNAL: HTTP/2 error code: INTERNAL_ERROR
Received Goaway
    at io.grpc.Status.asRuntimeException(Status.java:526)
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:419)
    at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41)
    at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:684)
    at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41)
    at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:392)
    at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:475)
    at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:557)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:478)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:590)
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
    at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:337)
    at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:745)
Mar 07, 2018 11:18:41 AM io.grpc.netty.NettyServerHandler onHeadersRead
WARNING: Exception in onHeadersRead()
jgarcia241 commented 6 years ago

Works fine if deployed the 'normal' way.