[ https://issues.apache.org/jira/browse/ZOOKEEPER-1441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16684312#comment-16684312 ]
Andor Molnar commented on ZOOKEEPER-1441: ----------------------------------------- I might have found the issue: QuorumUtil creates QuorumPeers in its constructor, but doesn't actually start them resulting it creates NIOServerCnxnFactory, but doesn't start its threads. It could be a bug in the factory that in the constructor of Accept/Select threads it opens and registers selectors on the socket, but if the thread is not running, closeSelector() method will not be called. This is exactly what QuorumUtil is doing in tests: creates QuorumPeers without starting them and in startAll() (which is always the call after the constructor) shuts down them all and create new ones and starting them. In Java 11 we have to properly close (unregister) selectors in order to properly close the socket. I'm working on a patch to fix this. > Some test cases are failing because Port bind issue. > ---------------------------------------------------- > > Key: ZOOKEEPER-1441 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1441 > Project: ZooKeeper > Issue Type: Test > Components: server, tests > Reporter: kavita sharma > Assignee: Andor Molnar > Priority: Major > Labels: flaky, flaky-test > > very frequently testcases are failing because of : > java.net.BindException: Address already in use > at sun.nio.ch.Net.bind(Native Method) > at > sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126) > at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59) > at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52) > at > org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:111) > at > org.apache.zookeeper.server.ServerCnxnFactory.createFactory(ServerCnxnFactory.java:112) > at > org.apache.zookeeper.server.quorum.QuorumPeer.<init>(QuorumPeer.java:514) > at > org.apache.zookeeper.test.QuorumBase.startServers(QuorumBase.java:156) > at org.apache.zookeeper.test.QuorumBase.setUp(QuorumBase.java:103) > at org.apache.zookeeper.test.QuorumBase.setUp(QuorumBase.java:67) > may be because of Port Assignment so please give me some suggestions if > someone is also facing same problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)