Well, if java.net.PlainSocketImpl.socketBind(Native Method) could tell us what grabbed the port after we found it was free, then that would provide us with very valuable information on whether or not we could prevent this.
Otherwise, AvailablePort is already selecting a not-in-use port for the test to use. Any sort of port reservation system would need to be in-process where the port is going to be used which would work for some tests but not all of them. -Kirk On Tue, Sep 6, 2016 at 8:00 AM, Anthony Baker <aba...@pivotal.io> wrote: > How could we fix AvailablePort so we don’t try to use in-use ports? > > Anthony > > > On Sep 3, 2016, at 10:29 PM, Kirk Lund <kl...@apache.org> wrote: > > > > We're still hitting BindExceptions in the nightly build, so I'll go ahead > > and propose this again: any test that uses AvailablePort to find a random > > port could be altered to automatically Retry if it encounters and fails > > because of java.net.BindException. Opinions? > > > > -Kirk > > > > :geode-core:integrationTest > > > > com.gemstone.gemfire.internal.cache.DiskRegionJUnitTest > > > testBridgeServerRunningInSynchPersistOnlyForIOExceptionCase FAILED > > java.net.BindException: Failed to create server socket on null[5,555] > > at com.gemstone.gemfire.internal.SocketCreator.createServerSock > et( > > SocketCreator.java:814) > > at com.gemstone.gemfire.internal.SocketCreator.createServerSock > et( > > SocketCreator.java:774) > > at com.gemstone.gemfire.internal.SocketCreator.createServerSock > et( > > SocketCreator.java:738) > > at com.gemstone.gemfire.internal.cache.tier.sockets. > > AcceptorImpl.<init>(AcceptorImpl.java:470) > > at com.gemstone.gemfire.internal.cache.CacheServerImpl.start( > > CacheServerImpl.java:323) > > at com.gemstone.gemfire.internal.cache.DiskRegionJUnitTest. > > testBridgeServerRunningInSynchPersistOnlyForIOExceptionCase( > > DiskRegionJUnitTest.java:2215) > > > > Caused by: > > java.net.BindException: Address already in use > > at java.net.PlainSocketImpl.socketBind(Native Method) > > at java.net.AbstractPlainSocketImpl.bind( > > AbstractPlainSocketImpl.java:387) > > at java.net.ServerSocket.bind(ServerSocket.java:375) > > at com.gemstone.gemfire.internal.SocketCreator. > > createServerSocket(SocketCreator.java:811) > > ... 5 more > > > > com.gemstone.gemfire.internal.cache.DiskRegionJUnitTest > > > testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase FAILED > > java.net.BindException: Failed to create server socket on null[5,555] > > at com.gemstone.gemfire.internal.SocketCreator.createServerSock > et( > > SocketCreator.java:814) > > at com.gemstone.gemfire.internal.SocketCreator.createServerSock > et( > > SocketCreator.java:774) > > at com.gemstone.gemfire.internal.SocketCreator.createServerSock > et( > > SocketCreator.java:738) > > at com.gemstone.gemfire.internal.cache.tier.sockets. > > AcceptorImpl.<init>(AcceptorImpl.java:470) > > at com.gemstone.gemfire.internal.cache.CacheServerImpl.start( > > CacheServerImpl.java:323) > > at com.gemstone.gemfire.internal.cache.DiskRegionJUnitTest. > > testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase > > (DiskRegionJUnitTest.java:2103) > > > > Caused by: > > java.net.BindException: Address already in use > > at java.net.PlainSocketImpl.socketBind(Native Method) > > at java.net.AbstractPlainSocketImpl.bind( > > AbstractPlainSocketImpl.java:387) > > at java.net.ServerSocket.bind(ServerSocket.java:375) > > at com.gemstone.gemfire.internal.SocketCreator. > > createServerSocket(SocketCreator.java:811) > > ... 5 more > > > > 3247 tests completed, 2 failed, 175 skipped > >