Kirk- Follow this logic...
[1] https://github.com/spring-projects/spring-session-data-geode/blob/master/samples/boot/gemfire/src/main/java/sample/client/IntegrationTestConfiguration.java#L70-L71 Which is based on the Registration of a ClientMembershipListener... [2] https://github.com/spring-projects/spring-session-data-geode/blob/master/samples/boot/gemfire/src/main/java/sample/client/IntegrationTestConfiguration.java#L154-L167 And this logic... [3] https://github.com/spring-projects/spring-session-data-geode/blob/master/samples/boot/gemfire/src/main/java/sample/client/IntegrationTestConfiguration.java#L103-L109 And this logic for reassurance... [4] https://github.com/spring-projects/spring-session-data-geode/blob/master/samples/boot/gemfire/src/main/java/sample/client/IntegrationTestConfiguration.java#L112-L137 I hit similar Exceptions in the Spring Session Data Geode client/server integration test suite. If you have questions, let me know. Regards, -John On Thu, May 3, 2018 at 11:03 AM, Kirk Lund <kl...@apache.org> wrote: > Anil and I were hoping that adding line 4 below would remove the race, but > it doesn't. CacheServer.isRunning() returns true as soon as AcceptorImpl is > non-null which is still before ServerSocket.accept() has been invoked. The > race still exists with this... > > 1: CacheServer cacheServer = getCache().addCacheServer(); > 2: cacheServer.setPort(0); > 3: cacheServer.start(); > *4: await().atMost(1, MINUTES).until(() -> cacheServer.isRunning());* > 5: return cacheServer.getPort(); > > I think we would have to change the implementation of > CacheServer.isRunning() to check ServerSocket.isBound(): > > CacheServer.isRunning: > public boolean isRunning() { > return this.acceptor != null && this.acceptor.isRunning(); > } > > AcceptorImpl.isRunning: > public boolean isRunning() { > return !this.shutdownStarted; > } > > Would need to change to something like this: > public boolean isRunning() { > return !this.shutdownStarted *&& serverSock.isBound();* > } > > Any opinions or alternatives? If I add "*&& serverSock.isBound();*" am I > going to break isRunning? > > On Thu, May 3, 2018 at 9:33 AM, Kirk Lund <kl...@apache.org> wrote: > > > I have a test which starts a server and then starts a client. But the > > client intermittently fails with NoSubscriptionServersAvailableException > > (see full stack below). > > > > Seems like there must be something asynchronous in the startup of a > > CacheServer that I need to wait for. Any ideas what I need to test for to > > avoid NoSubscriptionServersAvailableException? > > > > org.apache.geode.internal.cache.InitializedDiskRegionWithIoExc > eptionRegressionTest > > > cacheServerPersistWithIOExceptionShouldShutdown FAILED > > org.apache.geode.test.dunit.RMIException: While invoking > > org.apache.geode.internal.cache.InitializedDiskRegionWithIoExc > > eptionRegressionTest$$Lambda$23/1222369873.run in VM 1 running on Host > > 0b1780a0efc9 with 4 VMs > > at org.apache.geode.test.dunit.VM.invoke(VM.java:436) > > at org.apache.geode.test.dunit.VM.invoke(VM.java:405) > > at org.apache.geode.test.dunit.VM.invoke(VM.java:348) > > at org.apache.geode.internal.cache. > InitializedDiskRegionWithIoExc > > eptionRegressionTest.cacheServerPersistWithIOExceptionShouldShutdown( > > InitializedDiskRegionWithIoExceptionRegressionTest.java:113) > > > > Caused by: > > org.apache.geode.cache.NoSubscriptionServersAvailableException: > > org.apache.geode.cache.NoSubscriptionServersAvailableException: Could > not > > initialize a primary queue on startup. No queue servers available. > > at org.apache.geode.cache.client.internal.QueueManagerImpl. > > getAllConnections(QueueManagerImpl.java:187) > > at org.apache.geode.cache.client.internal.OpExecutorImpl. > > executeOnQueuesAndReturnPrimaryResult(OpExecutorImpl.java:539) > > at org.apache.geode.cache.client.internal.PoolImpl. > > executeOnQueuesAndReturnPrimaryResult(PoolImpl.java:850) > > at org.apache.geode.cache.client.internal.RegisterInterestOp. > > execute(RegisterInterestOp.java:58) > > at org.apache.geode.cache.client.internal.ServerRegionProxy. > > registerInterest(ServerRegionProxy.java:356) > > at org.apache.geode.internal.cache.LocalRegion. > processSingleInterest( > > LocalRegion.java:3749) > > at org.apache.geode.internal.cache.LocalRegion. > > registerInterest(LocalRegion.java:3840) > > at org.apache.geode.internal.cache.LocalRegion. > > registerInterest(LocalRegion.java:3638) > > at org.apache.geode.internal.cache.LocalRegion. > > registerInterest(LocalRegion.java:3633) > > at org.apache.geode.internal.cache.LocalRegion. > > registerInterest(LocalRegion.java:3628) > > at org.apache.geode.internal.cache.InitializedDiskRegionWithIoExc > > eptionRegressionTest.createClientCache(InitializedDiskRegionWithIoExc > > eptionRegressionTest.java:172) > > at org.apache.geode.internal.cache.InitializedDiskRegionWithIoExc > > eptionRegressionTest.lambda$cacheServerPersistWithIOExcept > > ionShouldShutdown$2c6907a2$1(InitializedDiskRegionWithIoExc > > eptionRegressionTest.java:113) > > > > Caused by: > > org.apache.geode.cache.NoSubscriptionServersAvailableException: Could > not > > initialize a primary queue on startup. No queue servers available. > > at org.apache.geode.cache.client.internal.QueueManagerImpl. > > initializeConnections(QueueManagerImpl.java:585) > > at org.apache.geode.cache.client.internal.QueueManagerImpl. > > start(QueueManagerImpl.java:296) > > at org.apache.geode.cache.client.internal.PoolImpl.start( > > PoolImpl.java:347) > > at org.apache.geode.cache.client.internal.PoolImpl. > > finishCreate(PoolImpl.java:172) > > at org.apache.geode.cache.client.internal.PoolImpl.create( > > PoolImpl.java:158) > > at org.apache.geode.internal.cache.PoolFactoryImpl.create( > > PoolFactoryImpl.java:346) > > at org.apache.geode.internal.cache.InitializedDiskRegionWithIoExc > > eptionRegressionTest.createClientCache(InitializedDiskRegionWithIoExc > > eptionRegressionTest.java:164) > > ... 1 more > > > > > -- -John john.blum10101 (skype)