We could remove the puts as its not doing any tests with put operation; if its required for establishing initial connection, then do put from client, clear is not needed.
-Anil. On Wed, Mar 15, 2017 at 3:54 PM, Darrel Schneider <dschnei...@pivotal.io> wrote: > The problem with this test is that is does register interest. The first > client that calls the put method does 2 puts, then a clear, then 2 puts, > then a clear. All of those ops get sent async to the other client. So when > you call the same put method on the second client it can be receiving the > events from the first client. When you see the "null" right after client 2 > did a put it is because you processed one of the clears from client1. > > From looking at this test it is unclear to me why is does puts and clears. > For the health stats it is trying to verify I would not think any of these > ops are needed. Or you could add some type of listener on client2 and wait > for it to see 2 clears before you have it execute the put task. > > Hope this helps > > On Wed, Mar 15, 2017 at 9:20 AM, Kirk Lund <kl...@apache.org> wrote: > > > I'm looking into a CI test failure > > (ClientHealthStatsDUnitTest.testClientHealthStats_SubscriptionEnabled). > I > > don't see anything wrong with the test so far. > > > > It looks to me like region.getEntry(KEY1) must have either returned a > null > > RegionEntry or RegionEntry.getValue returned a null immediately after the > > same thread that just called region.put(KEY1, VALUE1). I'm looking for > > confirmation that this is incorrect behavior or more info about how and > why > > this would be correct: > > > > private static final String KEY1 = "KEY1"; > > private static final String VALUE1 = "VALUE1"; > > > > 365: Cache cache = (Cache) clientCache; > > 366: Region<String, String> region = cache.getRegion(Region.SEPARATOR + > > REGION_NAME); > > 367: > > 368: *region.put(KEY1, VALUE1);* > > 369: *assertThat(region.getEntry(KEY1).getValue()).isEqualTo(VALUE1); > <-- > > throws NPE* > > > > The following is the setup code that configured and created clientCache: > > > > Properties props = new Properties(); > > props.setProperty(STATISTIC_SAMPLING_ENABLED, "true"); > > > > ClientCacheFactory cacheFactory = new ClientCacheFactory(props); > > if (subscriptionEnabled) { > > cacheFactory.setPoolSubscriptionEnabled(true); > > cacheFactory.setPoolSubscriptionAckInterval(50); > > cacheFactory.setPoolSubscriptionRedundancy(0); > > } > > > > cacheFactory.set(DURABLE_CLIENT_ID, "DurableClientId_" + clientNum); > > cacheFactory.set(DURABLE_CLIENT_TIMEOUT, "" + 30000); > > > > cacheFactory.addPoolServer(hostName, port); > > clientCache = cacheFactory.create(); > > > > ClientRegionFactory<String, String> regionFactory = > > > > clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_ > PROXY); > > regionFactory.setConcurrencyChecksEnabled(false); > > > > regionFactory.addCacheListener(new CacheListenerAdapter<String, > > String>() { > > @Override > > public void afterInvalidate(final EntryEvent<String, String> > event) { > > numOfInvalidates++; > > } > > > > @Override > > public void afterCreate(final EntryEvent<String, String> event) { > > if ("last_key".equals(event.getKey())) { > > lastKeyReceived = true; > > } > > numOfCreates++; > > } > > > > @Override > > public void afterUpdate(final EntryEvent<String, String> event) { > > numOfUpdates++; > > } > > }); > > > > Region<String, String> region = regionFactory.create(REGION_NAME); > > if (subscriptionEnabled) { > > region.registerInterest("ALL_KEYS", true); > > clientCache.readyForEvents(); > > } > > } > > > > The following is the stack trace showing the NPE: > > > > org.apache.geode.test.dunit.RMIException: While invoking > > org.apache.geode.management.ClientHealthStatsDUnitTest$$ > > Lambda$193/1653332728.run > > in VM 3 running on Host asf902.gq1.ygridcore.net with 4 VMs > > at org.apache.geode.test.dunit.VM.invoke(VM.java:377) > > at org.apache.geode.test.dunit.VM.invoke(VM.java:347) > > at org.apache.geode.test.dunit.VM.invoke(VM.java:292) > > at > > org.apache.geode.management.ClientHealthStatsDUnitTest. > > testClientHealthStats_SubscriptionEnabled(ClientHealthStatsDUnitTest. > > java:128) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java: > > 62) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( > > FrameworkMethod.java:50) > > at > > org.junit.internal.runners.model.ReflectiveCallable.run( > > ReflectiveCallable.java:12) > > at > > org.junit.runners.model.FrameworkMethod.invokeExplosively( > > FrameworkMethod.java:47) > > at > > org.junit.internal.runners.statements.InvokeMethod. > > evaluate(InvokeMethod.java:17) > > at > > org.junit.internal.runners.statements.RunBefores. > > evaluate(RunBefores.java:26) > > at > > org.junit.internal.runners.statements.RunAfters.evaluate( > > RunAfters.java:27) > > at > > org.apache.geode.management.ManagementTestRule$2.evaluate( > > ManagementTestRule.java:86) > > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > > BlockJUnit4ClassRunner.java:78) > > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild( > > BlockJUnit4ClassRunner.java:57) > > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > > at > > org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter. > > runTestClass(JUnitTestClassExecuter.java:114) > > at > > org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter. > > execute(JUnitTestClassExecuter.java:57) > > at > > org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor. > > processTestClass(JUnitTestClassProcessor.java:66) > > at > > org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor. > > processTestClass(SuiteTestClassProcessor.java:51) > > at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > > org.gradle.internal.dispatch.ReflectionDispatch.dispatch( > > ReflectionDispatch.java:35) > > at > > org.gradle.internal.dispatch.ReflectionDispatch.dispatch( > > ReflectionDispatch.java:24) > > at > > org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch( > > ContextClassLoaderDispatch.java:32) > > at > > org.gradle.internal.dispatch.ProxyDispatchAdapter$ > > DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) > > at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) > > at > > org.gradle.api.internal.tasks.testing.worker.TestWorker. > > processTestClass(TestWorker.java:109) > > at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > > org.gradle.internal.dispatch.ReflectionDispatch.dispatch( > > ReflectionDispatch.java:35) > > at > > org.gradle.internal.dispatch.ReflectionDispatch.dispatch( > > ReflectionDispatch.java:24) > > at > > org.gradle.internal.remote.internal.hub.MessageHub$ > > Handler.run(MessageHub.java:377) > > at > > org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures. > > onExecute(ExecutorPolicy.java:54) > > at > > org.gradle.internal.concurrent.StoppableExecutorImpl$1.run( > > StoppableExecutorImpl.java:40) > > at > > java.util.concurrent.ThreadPoolExecutor.runWorker( > > ThreadPoolExecutor.java:1142) > > at > > java.util.concurrent.ThreadPoolExecutor$Worker.run( > > ThreadPoolExecutor.java:617) > > at java.lang.Thread.run(Thread.java:745) > > *Caused by: java.lang.NullPointerException* > > * at > > org.apache.geode.management.ClientHealthStatsDUnitTest.put( > > ClientHealthStatsDUnitTest.java:369)* > > at > > org.apache.geode.management.ClientHealthStatsDUnitTest. > > lambda$testClientHealthStats_SubscriptionEnabled$bb17a952$ > > 2(ClientHealthStatsDUnitTest.java:128) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java: > > 62) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at hydra.MethExecutor.executeObject(MethExecutor.java:245) > > at > > org.apache.geode.test.dunit.standalone.RemoteDUnitVM. > > executeMethodOnObject(RemoteDUnitVM.java:73) > > at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke( > > DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346) > > at sun.rmi.transport.Transport$1.run(Transport.java:200) > > at sun.rmi.transport.Transport$1.run(Transport.java:197) > > at java.security.AccessController.doPrivileged(Native Method) > > at sun.rmi.transport.Transport.serviceCall(Transport.java:196) > > at sun.rmi.transport.tcp.TCPTransport.handleMessages( > > TCPTransport.java:568) > > at > > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0( > > TCPTransport.java:826) > > at > > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$ > > 0(TCPTransport.java:683) > > at java.security.AccessController.doPrivileged(Native Method) > > at > > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run( > > TCPTransport.java:682) > > ... 3 more > > >