You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Xiaoyu Yao (JIRA)" <ji...@apache.org> on 2018/01/11 19:02:00 UTC

[jira] [Commented] (RATIS-191) Support SO_REUSEADDR to avoid netty server bind failure

    [ https://issues.apache.org/jira/browse/RATIS-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16322754#comment-16322754 ] 

Xiaoyu Yao commented on RATIS-191:
----------------------------------

Here is the stack from TestCBlcokReadWrite#testContainerWrites. This could be avoided if we add the following in NettyServer#start()
{code}
b.option(SO_REUSEADDR, true);
{code}

Here is the failure stack.
{code}
2018-01-11 10:49:33,087 [BP-21154728-192.168.2.143-1515696572698 heartbeating to localhost/127.0.0.1:49782] ERROR grpc.RaftGRpcService (ExitUtils.java:terminate(86)) - Terminating with exit status 1: Failed to start Grpc server
java.io.IOException: Failed to bind
	at org.apache.ratis.shaded.io.grpc.netty.NettyServer.start(NettyServer.java:160)
	at org.apache.ratis.shaded.io.grpc.internal.ServerImpl.start(ServerImpl.java:147)
	at org.apache.ratis.shaded.io.grpc.internal.ServerImpl.start(ServerImpl.java:79)
	at org.apache.ratis.grpc.RaftGRpcService.startService(RaftGRpcService.java:112)
	at org.apache.ratis.grpc.RaftGRpcService.<init>(RaftGRpcService.java:91)
	at org.apache.ratis.grpc.RaftGRpcService.<init>(RaftGRpcService.java:77)
	at org.apache.ratis.grpc.RaftGRpcService.<init>(RaftGRpcService.java:47)
	at org.apache.ratis.grpc.RaftGRpcService$Builder.build(RaftGRpcService.java:62)
	at org.apache.ratis.grpc.GrpcFactory.newRaftServerRpc(GrpcFactory.java:48)
	at org.apache.ratis.grpc.GrpcFactory.newRaftServerRpc(GrpcFactory.java:30)
	at org.apache.ratis.server.impl.RaftServerProxy.<init>(RaftServerProxy.java:64)
	at org.apache.ratis.server.impl.ServerImplUtils.lambda$newRaftServer$0(ServerImplUtils.java:40)
	at org.apache.ratis.util.JavaUtils.attempt(JavaUtils.java:123)
	at org.apache.ratis.server.impl.ServerImplUtils.newRaftServer(ServerImplUtils.java:39)
	at org.apache.ratis.server.RaftServer$Builder.build(RaftServer.java:70)
	at org.apache.hadoop.ozone.container.common.transport.server.ratis.XceiverServerRatis.<init>(XceiverServerRatis.java:87)
	at org.apache.hadoop.ozone.container.common.transport.server.ratis.XceiverServerRatis.newXceiverServerRatis(XceiverServerRatis.java:166)
	at org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer.<init>(OzoneContainer.java:121)
	at org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine.<init>(DatanodeStateMachine.java:79)
	at org.apache.hadoop.hdfs.server.datanode.DataNode.bpRegistrationSucceeded(DataNode.java:1590)
	at org.apache.hadoop.hdfs.server.datanode.BPOfferService.registrationSucceeded(BPOfferService.java:409)
	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.register(BPServiceActor.java:783)
	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:286)
	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:816)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:433)
	at sun.nio.ch.Net.bind(Net.java:425)
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.apache.ratis.shaded.io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:125)
	at org.apache.ratis.shaded.io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:554)
	at org.apache.ratis.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1258)
	at org.apache.ratis.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:511)
	at org.apache.ratis.shaded.io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:496)
	at org.apache.ratis.shaded.io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:980)
	at org.apache.ratis.shaded.io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250)
	at org.apache.ratis.shaded.io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:363)
	at org.apache.ratis.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.safeExecute(SingleThreadEventExecutor.java:451)
	at org.apache.ratis.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
	at org.apache.ratis.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:401)
	at org.apache.ratis.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877)
	at org.apache.ratis.shaded.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
	... 1 more
*** shutting down gRPC server since JVM is shutting down
*** shutting down gRPC server since JVM is shutting down
*** shutting down gRPC server since JVM is shutting down
*** shutting down gRPC server since JVM is shutting down
*** server shut down
*** server shut down
*** server shut down
*** server shut down

{code}

> Support SO_REUSEADDR to avoid netty server bind failure
> -------------------------------------------------------
>
>                 Key: RATIS-191
>                 URL: https://issues.apache.org/jira/browse/RATIS-191
>             Project: Ratis
>          Issue Type: Bug
>            Reporter: Xiaoyu Yao
>
> The bind failure was always hit when running some Ozone tests multiple times. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)