Closed glassfishrobot closed 14 years ago
@glassfishrobot Commented Reported by carryel
@glassfishrobot Commented carryel said: Created an attachment (id=15) GroupHanlde API test code
@glassfishrobot Commented @jfialli said: agree that GMS API methods should not be throwing NPE
@glassfishrobot Commented @jfialli said: Fixed.
Regression test is com.sun.enterprise.ee.cms.tests.core.GroupHandleTest.java. Shell script runAPITests.sh.
Verified that the originally checked in test filed with this bug also runs okay. Throw IllegalArgumentException when null is passed as a parameter and it is not allowed.
@glassfishrobot Commented File: SimpleShoalAPITest.java Attached By: carryel
@glassfishrobot Commented Was assigned to shreedhar_ganapathy
@glassfishrobot Commented This issue was imported from java.net JIRA SHOAL-86
@glassfishrobot Commented Marked as fixed on Wednesday, June 23rd 2010, 4:11:06 am
When GMS failed to join the group, GMS didn't throw a GMSException but unexpected exception like a NPE.
There are two issues.
1) GroupManagementService#join() API had better throw a GMSException instead of a NPE in an unexpected error. Here is the log.
D:\shoal\gms>rungmsdemo.bat testServer testGroup CORE 30000 INFO D:\ibm_sdk60\bin [#|2009-03- 31T10:32:01.677+0900|SEVERE|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=Applicatio nServer;C lassName=NetworkManager;MethodName=;|Could not locate World PeerGroup
Module Implementation.
net.jxta.exception.PeerGroupException: Could not locate World PeerGroup Module
Implementation.
at
net.jxta.peergroup.WorldPeerGroupFactory.getDefaultWorldPeerGroupClass
(WorldPeerGroupFact
ory.java:244)
at net.jxta.peergroup.WorldPeerGroupFactory.
(WorldPeerGroupFactory.java:178)
at com.sun.enterprise.jxtamgmt.NetworkManager.initWPGF
(NetworkManager.java:623)
at com.sun.enterprise.jxtamgmt.NetworkManager.
(NetworkManager.java:213)
at com.sun.enterprise.jxtamgmt.ClusterManager.
(ClusterManager.java:133)
at
com.sun.enterprise.ee.cms.impl.jxta.GroupCommunicationProviderImpl.initializeGro
upCommuni
cationProvider(GroupCommunicationProviderImpl.java:138)
at com.sun.enterprise.ee.cms.impl.jxta.GMSContext.join
(GMSContext.java:123)
at com.sun.enterprise.ee.cms.impl.common.GroupManagementServiceImpl.join
(GroupManagementServ
iceImpl.java:339)
at com.sun.enterprise.ee.cms.tests.ApplicationServer.startGMS
(ApplicationServer.java:156)
at com.sun.enterprise.ee.cms.tests.ApplicationServer.run
(ApplicationServer.java:107)
at java.lang.Thread.run(Thread.java:735)
| #] |
Exception in thread "ApplicationServer" java.lang.NullPointerException at com.sun.enterprise.jxtamgmt.NetworkManager.getWorldPeerGroup (NetworkManager.java:725) at com.sun.enterprise.jxtamgmt.NetworkManager.startDomain (NetworkManager.java:696) at com.sun.enterprise.jxtamgmt.NetworkManager.start (NetworkManager.java:401) at com.sun.enterprise.jxtamgmt.ClusterManager.
(ClusterManager.java:136)
at
com.sun.enterprise.ee.cms.impl.jxta.GroupCommunicationProviderImpl.initializeGro
upCommuni
cationProvider(GroupCommunicationProviderImpl.java:138)
at com.sun.enterprise.ee.cms.impl.jxta.GMSContext.join
(GMSContext.java:123)
at com.sun.enterprise.ee.cms.impl.common.GroupManagementServiceImpl.join
(GroupManagementServ
iceImpl.java:339)
at com.sun.enterprise.ee.cms.tests.ApplicationServer.startGMS
(ApplicationServer.java:156)
at com.sun.enterprise.ee.cms.tests.ApplicationServer.run
(ApplicationServer.java:107)
at java.lang.Thread.run(Thread.java:735)
When you try to run rungmsdemo.bat in IBM JDK6, you can see NPEs in GroupManagementService#join().
2) At 1)'s case above, GMS's other APIs like the GroupHandle need graceful handling of this problem.
I wrote some codes for this test(SimpleShoalAPITest.java).
Test code is simple.
try { gms.join(); } catch( GMSException e ) { // It's OK. throw e; } catch( Throwable t ) { // unexpected error. List exceptions = testSimpleAPIsWithUnexpectedException( gms );
// print unexpected exceptions
// ...
}
private List testSimpleAPIsWithUnexpectedException(
GroupManagementService gms ) {
if( gms == null )
return null; // It's OK.
List unexpectedExceptions = new Vector();
String dummyString = "";
byte[] dummyBytes = new byte[0];
GroupHandle gh = gms.getGroupHandle(); if( gh == null ) return null; // It's OK. // test APIs // ... }
when GMS failed to join the group, but if GMS was not null and GroupHandle was not null, I checked all GroupHandle's APIs with dummy String and dummy bytes.
Here is the full log
D:\shoal\gms>java -classpath classes;lib\jxta.jar com.sun.enterprise.shoal.carryel.SimpleShoalAPITes t [#|2009-03- 31T11:32:01.458+0900|INFO|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassNa me=Simple ShoalAPITest;MethodName=runSimpleSample;|Starting SimpleShoalAPITest....|#]
[#|2009-03- 31T11:32:02.052+0900|INFO|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassNa me=Simple ShoalAPITest;MethodName=initializeGMS;|Initializing Shoal for member: 67fbe786- ff24-4a1f-81d2-d795bc b9dd16 group:TestGroup|#]
[#|2009-03- 31T11:32:02.068+0900|FINE|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassNa me=GMSCon text;MethodName=;|Initialized Group Communication System....|#]
[#|2009-03- 31T11:32:02.068+0900|INFO|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassNa me=Simple ShoalAPITest;MethodName=runSimpleSample;|Joining Group TestGroup|#]
[#|2009-03- 31T11:32:02.068+0900|FINE|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassNa me=GroupM anagementServiceImpl;MethodName=join;|Connecting to group......|#]
[#|2009-03- 31T11:32:02.130+0900|CONFIG|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Jxta Util;MethodName=configureJxtaLogging;|gms configureJxtaLogging: set jxta logging to default of SEVER E|#]
[#|2009-03- 31T11:32:02.208+0900|CONFIG|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Netw orkManager;MethodName=initWPGF;|initWPGF storeHome=.shoal\67fbe786-ff24-4a1f- 81d2-d795bcb9dd16|#]
[#|2009-03- 31T11:32:02.208+0900|FINER|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassN ame=Netwo rkManager;MethodName=clearCache;|clearCache(.shoal\67fbe786-ff24-4a1f-81d2- d795bcb9dd16) on non-exsi stent directory|#]
[#|2009-03- 31T11:32:02.443+0900|SEVERE|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Netw orkManager;MethodName=;|Could not locate World PeerGroup Module
Implementation.
net.jxta.exception.PeerGroupException: Could not locate World PeerGroup Module
Implementation.
at
net.jxta.peergroup.WorldPeerGroupFactory.getDefaultWorldPeerGroupClass
(WorldPeerGroupFact
ory.java:244)
at net.jxta.peergroup.WorldPeerGroupFactory.
(WorldPeerGroupFactory.java:178)
at com.sun.enterprise.jxtamgmt.NetworkManager.initWPGF
(NetworkManager.java:623)
at com.sun.enterprise.jxtamgmt.NetworkManager.
(NetworkManager.java:213)
at com.sun.enterprise.jxtamgmt.ClusterManager.
(ClusterManager.java:133)
at
com.sun.enterprise.ee.cms.impl.jxta.GroupCommunicationProviderImpl.initializeGro
upCommuni
cationProvider(GroupCommunicationProviderImpl.java:138)
at com.sun.enterprise.ee.cms.impl.jxta.GMSContext.join
(GMSContext.java:123)
at com.sun.enterprise.ee.cms.impl.common.GroupManagementServiceImpl.join
(GroupManagementServ
iceImpl.java:339)
at com.sun.enterprise.shoal.carryel.SimpleShoalAPITest.runSimpleSample
(SimpleShoalAPITest.ja
va:42)
at com.sun.enterprise.shoal.carryel.SimpleShoalAPITest.main
(SimpleShoalAPITest.java:25)
| #] |
[#|2009-03- 31T11:32:02.443+0900|FINE|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassNa me=Networ kManager;MethodName=startDomain;|Rendezvous seed?:false|#]
[#|2009-03- 31T11:32:02.443+0900|CONFIG|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Netw orkManager;MethodName=startDomain;|set jxta Multicast Poolsize to 300|#]
[#|2009-03- 31T11:32:02.458+0900|CONFIG|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Netw orkManager;MethodName=startDomain;|node config adv = <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jxta:CP> <jxta:CP xml:space="default" type="jxta:PlatformConfig" xmlns:jxta="http://jxta.org">
</jxta:CP>
| #] |
[#|2009-03- 31T11:32:02.505+0900|SEVERE|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Simp leShoalAPITest;MethodName=runSimpleSample;|Unexpected exception occured while joining group: java.lang.NullPointerException at com.sun.enterprise.jxtamgmt.NetworkManager.getWorldPeerGroup (NetworkManager.java:725) at com.sun.enterprise.jxtamgmt.NetworkManager.startDomain (NetworkManager.java:696) at com.sun.enterprise.jxtamgmt.NetworkManager.start (NetworkManager.java:401) at com.sun.enterprise.jxtamgmt.ClusterManager.
(ClusterManager.java:136)
at
com.sun.enterprise.ee.cms.impl.jxta.GroupCommunicationProviderImpl.initializeGro
upCommuni
cationProvider(GroupCommunicationProviderImpl.java:138)
at com.sun.enterprise.ee.cms.impl.jxta.GMSContext.join
(GMSContext.java:123)
at com.sun.enterprise.ee.cms.impl.common.GroupManagementServiceImpl.join
(GroupManagementServ
iceImpl.java:339)
at com.sun.enterprise.shoal.carryel.SimpleShoalAPITest.runSimpleSample
(SimpleShoalAPITest.ja
va:42)
at com.sun.enterprise.shoal.carryel.SimpleShoalAPITest.main
(SimpleShoalAPITest.java:25)
| #] |
[#|2009-03- 31T11:32:02.505+0900|FINER|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassN ame=Distr ibutedStateCacheImpl;MethodName=addToCache;|Adding to DSC by local Member:67fbe786-ff24-4a1f-81d2-d7 95bcb9dd16,Component:,key:,State:RECOVERY_IN_PROGRESS|1238466722505|#]
[#|2009-03- 31T11:32:02.505+0900|FINEST|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Dist ributedStateCacheImpl;MethodName=addToLocalCache;|Adding cKey=GMSMember:67fbe786-ff24-4a1f-81d2-d795 bcb9dd16:Component::key: state=RECOVERY_IN_PROGRESS|1238466722505|#]
[#|2009-03- 31T11:32:02.505+0900|FINER|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassN ame=Distr ibutedStateCacheImpl;MethodName=printDSCContents;|67fbe786-ff24-4a1f-81d2- d795bcb9dd16:DSC now conta ins --------- 209999666 key=GMSMember:67fbe786-ff24-4a1f-81d2-d795bcb9dd16:Component::key: : value=RECOVERY_IN_PRO GRESS|1238466722505
| #] |
[#|2009-03- 31T11:32:02.521+0900|FINER|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassN ame=Group HandleImpl;MethodName=isFenced;|GMSMember:67fbe786-ff24-4a1f-81d2- d795bcb9dd16:Component::key: value :RECOVERY_IN_PROGRESS|1238466722505|#]
[#|2009-03- 31T11:32:02.521+0900|FINER|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;ClassN ame=Group HandleImpl;MethodName=isFenced;|Returning true for isFenced query|#]
[#|2009-03- 31T11:32:02.521+0900|SEVERE|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Simp leShoalAPITest;MethodName=runSimpleSample;|Unexpected exceptions occured: GroupHandle#sendMessage( String, byte[] ): java.lang.NullPointerException GroupHandle#sendMessage( String, String, byte[] ): java.lang.NullPointerException GroupHandle#sendMessage( String, String, byte[] ): java.lang.NullPointerException GroupHandle#raiseFence( String, String ): java.lang.NullPointerException GroupHandle#lowerFence( String, String ): java.lang.NullPointerException GroupHandle#getMemberState( String ): java.lang.NullPointerException GroupHandle#getMemberState( String, long, long ): java.lang.NullPointerException GroupHandle#getGroupLeader(): java.lang.NullPointerException GroupHandle#isGroupLeader(): java.lang.NullPointerException
| #] |
[#|2009-03- 31T11:32:02.536+0900|SEVERE|Shoal|ShoalLogger|_ThreadID=0;_ThreadName=main;Class Name=Simp leShoalAPITest;MethodName=main;|Exception occured while testing some APIs:com.sun.enterprise.ee.cms. core.GMSException: java.lang.NullPointerException|#]
As you can see, the following APIs(9 methods) are not safe.
Shoal should improve these NPEs.
I attached my test code(SimpleShoalAPITest.java)
Environment
Operating System: All Platform: All
Affected Versions
[current]