When running the testng test for the messaging pattern, I noticed that under some scenarios I've encountered a hang.
In some scenarios I am using a single cache server and running the tests with localstorage=false. I have also seen this behavior when running the test with localstorage=true without a dedicated cache server.
"Main Thread" id=1 idx=0x4 tid=2728 prio=5 alive, in native, parked
-- Parking to wait for: java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject@0x08E02748
at jrockit/vm/Locks.park0(J)V(Native Method)
at jrockit/vm/Locks.park(Locks.java:2506)
at sun/misc/Unsafe.park(ZJ)V(Native Method)
at java/util/concurrent/locks/LockSupport.park(LockSupport.java:158)
at java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
at java/util/concurrent/LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
at com/oracle/coherence/patterns/messaging/AbstractSubscriber.getNextSubscriptionUpdate(AbstractSubscriber.java:247)
at com/oracle/coherence/patterns/messaging/AbstractSubscriber.ensureSubscription(AbstractSubscriber.java:278)
at com/oracle/coherence/patterns/messaging/TopicSubscriber.rollback(TopicSubscriber.java:180)
at TopicTests.nonDurableRollbackTest(TopicTests.java:88)
at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
at jrockit/vm/Reflect.invokeMethod(Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Native Method)
at sun/reflect/NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Native Method)
at sun/reflect/NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun/reflect/DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java/lang/reflect/Method.invoke(Method.java:597)
at org/testng/internal/MethodHelper.invokeMethod(MethodHelper.java:609)
at org/testng/internal/Invoker.invokeMethod(Invoker.java:532)
at org/testng/internal/Invoker.invokeTestMethod(Invoker.java:686)
at org/testng/internal/Invoker.invokeTestMethods(Invoker.java:1018)
at org/testng/internal/TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
at org/testng/internal/TestMethodWorker.run(TestMethodWorker.java:112)
at org/testng/TestRunner.runWorkers(TestRunner.java:759)
at org/testng/TestRunner.privateRun(TestRunner.java:592)
at org/testng/TestRunner.run(TestRunner.java:486)
at org/testng/SuiteRunner.runTest(SuiteRunner.java:332)
at org/testng/SuiteRunner.runSequentially(SuiteRunner.java:327)
at org/testng/SuiteRunner.privateRun(SuiteRunner.java:299)
at org/testng/SuiteRunner.run(SuiteRunner.java:204)
at org/testng/TestNG.createAndRunSuiteRunners(TestNG.java:912)
at org/testng/TestNG.runSuitesLocally(TestNG.java:876)
at org/testng/TestNG.run(TestNG.java:784)
at org/testng/TestNG.privateMain(TestNG.java:949)
at org/testng/TestNG.main(TestNG.java:922)
at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
-- end of trace
It appears that in AbstractSubscriber there may be a potential for a hang with this code, but I'm not sure. It looks like the call to getNextSubscriptionUpdate() is in the call path.
void ensureSubscription() {
State state = getState();
if (state == State.Starting) {
//wait for the subscription state to arrive
getNextSubscriptionUpdate();
}
If the subscription does move into the Active state before the subscriptionUpdates.take() is called (I'm not even sure if that's possible, but presume it is), then could this be why I'm seeing a lock?
protected S getNextSubscriptionUpdate() {
try {
//get the next available subscription state
//(wait's if it has not arrived)
S subscription = subscriptionUpdates.take();
Thanks,
James