2021年1月15日星期五

java BindException: Address already in use: bind even though port is free

I am testing out torchserve with its default configuration... its inference api listen to port 8080. and I got this error which means the port is in use. my bad, I still have apache process listening to that port. I killed the apache process. But i still get the same error. Tried again by changing port configuration of torchserve to use port that I know for sure is not being used by any process. still got the same error.

so anyone has anymore idea why is this happening? is there maybe some sort of cache mechanism which makes it still failing to bind on a port which is already free?

the stack trace

java.io.IOException: Failed to bind          at io.grpc.netty.shaded.io.grpc.netty.NettyServer.start(NettyServer.java:264)          at io.grpc.internal.ServerImpl.start(ServerImpl.java:183)          at io.grpc.internal.ServerImpl.start(ServerImpl.java:90)          at org.pytorch.serve.ModelServer.startGRPCServer(ModelServer.java:396)          at org.pytorch.serve.ModelServer.startGRPCServers(ModelServer.java:377)          at org.pytorch.serve.ModelServer.startAndWait(ModelServer.java:116)          at org.pytorch.serve.ModelServer.main(ModelServer.java:95)  Caused by: java.net.BindException: Address already in use: bind          at java.base/sun.nio.ch.Net.bind0(Native Method)          at java.base/sun.nio.ch.Net.bind(Net.java:461)          at java.base/sun.nio.ch.Net.bind(Net.java:453)          at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)          at io.grpc.netty.shaded.io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)          at io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:550)          at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)          at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)          at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)          at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)          at io.grpc.netty.shaded.io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248)          at io.grpc.netty.shaded.io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)          at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)          at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)          at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)          at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)          at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)          at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)          at java.base/java.lang.Thread.run(Thread.java:834)  Exception in thread "Thread-0" java.util.concurrent.RejectedExecutionException: event executor terminated          at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:926)          at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:353)          at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:346)          at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:828)          at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:818)          at io.netty.channel.AbstractChannelHandlerContext.safeExecute(AbstractChannelHandlerContext.java:989)          at io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:608)          at io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:472)          at io.netty.channel.DefaultChannelPipeline.close(DefaultChannelPipeline.java:957)          at io.netty.channel.AbstractChannel.close(AbstractChannel.java:232)          at org.pytorch.serve.ModelServer.stop(ModelServer.java:473)          at org.pytorch.serve.ModelServer$1.run(ModelServer.java:91)  
https://stackoverflow.com/questions/65745522/java-bindexception-address-already-in-use-bind-even-though-port-is-free January 16, 2021 at 09:06AM

没有评论:

发表评论