[
https://issues.apache.org/jira/browse/GEODE-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14660591#comment-14660591
]
Darrel Schneider commented on GEODE-138:
----------------------------------------
Looking at this test code it is unclear what the race is.
The test creates two servers both with a replicate. Server 2 is configured with
an eviction and critical limit.
A MemoryThresholdListener is registered in both server1 and server2.
It then does enough puts in server2 that it should go over the eviction limit
(setUsageAboveEvictionThreshold(server2, regionName);).
It then waits for the listener to see EVICTION on server1 and that works.
It then does not wait and asks the listener on server2 if it sees EVICTION and
that fails.
It seems to assume that the listener will be notified synchronously (with the
puts done) on server2 but async on server1. That is why it uses a wait criteria
on server1 but does not wait on server2.
The only thing possible clue is that I think noticing that off-heap memory was
gone over a limit (so that the listener will be notified) is an async
operation.
This method:
com.gemstone.gemfire.internal.cache.control.OffHeapMemoryMonitor.updateMemoryUsed(long)
notifies a listener:
{code}
public void updateMemoryUsed(final long bytesUsed) {
synchronized (this.offHeapMemoryUsageListener) {
this.offHeapMemoryUsageListener.offHeapMemoryUsed = bytesUsed;
this.offHeapMemoryUsageListener.notifyAll();
}
}
{code}
by calling notifyAll on a OffHeapMemoryUsageListener.
OffHeapMemoryUsageListener has a run block in a thread that
will wakeup and call updateStateAndSendEvent.
And it is updateStateAndSendEvent that ends up telling the test listener
that the state has changed to EVICT.
If all of this is correct then when the test calls verifyListenerValue on
server2 it needs to pass "true" instead of "false" for the useWaitCriterion
parameter.
> MemoryThresholdsOffHeapDUnitTest.testEventDelivery failed
> ----------------------------------------------------------
>
> Key: GEODE-138
> URL: https://issues.apache.org/jira/browse/GEODE-138
> Project: Geode
> Issue Type: Bug
> Affects Versions: 1.0.0-incubating
> Reporter: Kirk Lund
> Assignee: Darrel Schneider
> Priority: Minor
>
> This end-to-end test failed in Jenkins in build #159. Need to tighten up any
> race conditions and make this test more reliable.
> {code}
> dunit.RMIException: While invoking
> com.gemstone.gemfire.cache.management.MemoryThresholdsOffHeapDUnitTest$46.call
> in VM 1 running on Host asf911.gq1.ygridcore.net with 4 VMs
> at dunit.VM.invoke(VM.java:359)
> at dunit.VM.invoke(VM.java:303)
> at dunit.VM.invoke(VM.java:271)
> at
> com.gemstone.gemfire.cache.management.MemoryThresholdsOffHeapDUnitTest.verifyListenerValue(MemoryThresholdsOffHeapDUnitTest.java:1568)
> at
> com.gemstone.gemfire.cache.management.MemoryThresholdsOffHeapDUnitTest.testEventDelivery(MemoryThresholdsOffHeapDUnitTest.java:149)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at junit.framework.TestCase.runTest(TestCase.java:176)
> at junit.framework.TestCase.runBare(TestCase.java:141)
> at junit.framework.TestResult$1.protect(TestResult.java:122)
> at junit.framework.TestResult.runProtected(TestResult.java:142)
> at junit.framework.TestResult.run(TestResult.java:125)
> at junit.framework.TestCase.run(TestCase.java:129)
> at junit.framework.TestSuite.runTest(TestSuite.java:252)
> at junit.framework.TestSuite.run(TestSuite.java:247)
> at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
> at
> org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
> at
> org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
> at
> org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:64)
> at
> org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:50)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
> at
> org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
> at
> org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
> at
> org.gradle.messaging.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:106)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
> at
> org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
> at
> org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
> at
> org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: junit.framework.AssertionFailedError: expected:<1> but was:<0>
> at junit.framework.Assert.fail(Assert.java:57)
> at junit.framework.Assert.failNotEquals(Assert.java:329)
> at junit.framework.Assert.assertEquals(Assert.java:78)
> at junit.framework.Assert.assertEquals(Assert.java:234)
> at junit.framework.Assert.assertEquals(Assert.java:241)
> at junit.framework.TestCase.assertEquals(TestCase.java:409)
> at
> com.gemstone.gemfire.cache.management.MemoryThresholdsOffHeapDUnitTest$46.call(MemoryThresholdsOffHeapDUnitTest.java:1634)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at hydra.MethExecutor.executeObject(MethExecutor.java:258)
> at
> dunit.standalone.RemoteDUnitVM.executeMethodOnObject(RemoteDUnitVM.java:67)
> at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
> at sun.rmi.transport.Transport$1.run(Transport.java:177)
> at sun.rmi.transport.Transport$1.run(Transport.java:174)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
> at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
> ... 3 more
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)