Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VertxServer shutdown cause java.lang.IndexOutOfBoundsException. #115

Open
coding4m opened this issue Mar 9, 2022 · 2 comments
Open

VertxServer shutdown cause java.lang.IndexOutOfBoundsException. #115

coding4m opened this issue Mar 9, 2022 · 2 comments
Labels

Comments

@coding4m
Copy link
Contributor

coding4m commented Mar 9, 2022

Version

vertx 4.2.5
grpc-java 1.44.1

Context

exception stack trace:

2022-03-09T15:16:02,302 WARN  io.netty.util.concurrent.DefaultPromise - An exception was thrown by io.grpc.netty.NettyServerHandler$5.operationComplete()
Mar 09 15:16:02 start[18365]: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Mar 09 15:16:02 start[18365]: at java.util.ArrayList.rangeCheck(ArrayList.java:659) ~[?:1.8.0_301]
Mar 09 15:16:02 start[18365]: at java.util.ArrayList.get(ArrayList.java:435) ~[?:1.8.0_301]
Mar 09 15:16:02 start[18365]: at io.vertx.grpc.VertxServer$ActualServer.lambda$new$1(VertxServer.java:91) ~[io.vertx.vertx-grpc-4.2.5.jar:4.2.5]
Mar 09 15:16:02 start[18365]: at io.grpc.internal.SerializingExecutor.schedule(SerializingExecutor.java:102) ~[io.grpc.grpc-core-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.grpc.internal.SerializingExecutor.execute(SerializingExecutor.java:95) ~[io.grpc.grpc-core-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener.closedInternal(ServerImpl.java:920) ~[io.grpc.grpc-core-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener.closed(ServerImpl.java:887) ~[io.grpc.grpc-core-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.grpc.internal.AbstractServerStream$TransportState.closeListener(AbstractServerStream.java:332) ~[io.grpc.grpc-core-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.grpc.internal.AbstractServerStream$TransportState.complete(AbstractServerStream.java:298) ~[io.grpc.grpc-core-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.grpc.netty.NettyServerStream$TransportState.complete(NettyServerStream.java:168) ~[io.grpc.grpc-netty-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.grpc.netty.NettyServerHandler$5.operationComplete(NettyServerHandler.java:682) ~[io.grpc.grpc-netty-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.grpc.netty.NettyServerHandler$5.operationComplete(NettyServerHandler.java:679) ~[io.grpc.grpc-netty-1.44.1.jar:1.44.1]
Mar 09 15:16:02 start[18365]: at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:578) ~[io.netty.netty-common-4.1.74.Final.jar:4.1.74.Final]
Mar 09 15:16:02 start[18365]: at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:571) ~[io.netty.netty-common-4.1.74.Final.jar:4.1.74.Final]
Mar 09 15:16:02 start[18365]: at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:550) ~[io.netty.netty-common-4.1.74.Final.jar:4.1.74.Final]

maybe call contextLocal.get().remove(context) after server.shutdown()

    void stop(ContextInternal context, Promise<Void> promise) {
      boolean shutdown = count.decrementAndGet() == 0;
      context.runOnContext(v -> {
        group.removeWorker(context.nettyEventLoop());
        **contextLocal.get().remove(context);**
        if (shutdown) {
          map.remove(id);
          context.executeBlocking(p -> {
            server.shutdown();
            p.complete();
          }, promise);
        } else {
          promise.complete();
        }
      });
    }
@coding4m coding4m added the bug label Mar 9, 2022
@vietj
Copy link
Contributor

vietj commented Mar 9, 2022

do you have a reproducer ?

@liangyuanpeng
Copy link

Have some reproduce step or code would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants