-
15. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
clebert.suconic Apr 17, 2006 11:00 AM (in response to clebert.suconic)Ah ok...
JBossMemoryTestCase could be considered abstract. I didn't specify the keyword abstract though but I could do it.
I guess this is okay then. -
17. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
bkeh12 Apr 18, 2006 11:10 AM (in response to clebert.suconic)Hi,Adrain
you configer is
<'property name="os.name" value="Linux"/>
<'property name="os.arch" value="i386"/>
<'property name="os.version" value="2.6.9-22.0.1.ELsmp"/>
<'property name="sun.boot.library.path" value="/opt/j2sdk1.4.2_07/jre/lib/i386"/>"clebert.suconic@jboss.com" wrote:
also, it's important to understand that this tool can only be used on a JVM 5. (needs JVMTI support)
thank -
18. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
clebert.suconic Apr 18, 2006 11:18 AM (in response to clebert.suconic)Chung,
This happens on cruisecontrol, which is an automatic building system. I should have taken care and make sure this would run there, it was my mistake... my bad.
Anyway, JVMTIInterface has a check fo the library being loaded.static { try { System.loadLibrary("jbossAgent"); } catch (Throwable e) { isLoaded=false; log.error("The DLL couldn't be loaded, you won't be able to use any JVMTIInterface feature",e); } }
This exception handling was broken before. ( I was using Exception e)
So, if jbossAgent.dll is not available, the test will just use a WeakReference, System.GC() and a timeout to make sure the reference is gone, and the test should work fine now.
You will see a bunch of jvmti.isActive on the super Class and on the test itself. -
20. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
bkeh12 Apr 20, 2006 2:30 AM (in response to clebert.suconic)Hi,Adrian
Why (sample1) use MC's Javassist reflect model to test is perfectly right ?sample 1: public class ClassInfoMemoryTestCase extends JBossMemoryTestCase { ......... //Class simpleBeanClass = loader.loadClass("org.jboss.test.classinfo.support.SimpleBean"); //Class simpleBeanInterface = loader.loadClass("org.jboss.test.classinfo.support.SimpleInterface"); ClassInfo cinfo = getClassInfo("org.jboss.test.classinfo.support.SimpleBean",loader); cinfo=null; //Test if the reference on ClassInfo is not too weak JVMTIInterface jvmti = new JVMTIInterface(); if (jvmti.isActive()) { jvmti.forceGC(); assertEquals(1,jvmti.getAllObjects(ClassInfo.class).length); } cinfo = getClassInfo("org.jboss.test.classinfo.support.SimpleBean",loader); .......... protected TypeInfoFactory getTypeInfoFactory() { //return new IntrospectionTypeInfoFactory(); return new JavassistTypeInfoFactory(); } } Testsuite: org.jboss.test.memorytests.ClassInfoMemoryTestCase Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.218 sec ------------- Standard Output --------------- +++oldloader =sun.misc.Launcher$AppClassLoader@16930e2 +++newloader =java.net.FactoryURLClassLoader@1f14ceb ------------- ---------------- --------------- Testcase: testSimpleBeanClassInfo took 0.218 sec FAILED expected:<1> but was:<0> junit.framework.AssertionFailedError: expected:<1> but was:<0> at org.jboss.test.memorytests.ClassInfoMemoryTestCase.testSimpleBeanClassInfo(ClassInfoMemoryTestCase.java:75) sample 2: public class ClassInfoMemoryTestCase extends JBossMemoryTestCase { ......... //Class simpleBeanClass = loader.loadClass("org.jboss.test.classinfo.support.SimpleBean"); //Class simpleBeanInterface = loader.loadClass("org.jboss.test.classinfo.support.SimpleInterface"); ClassInfo cinfo = getClassInfo("org.jboss.test.classinfo.support.SimpleBean",loader); //cinfo=null; //Test if the reference on ClassInfo is not too weak //JVMTIInterface jvmti = new JVMTIInterface(); //if (jvmti.isActive()) //{ // jvmti.forceGC(); // assertEquals(1,jvmti.getAllObjects(ClassInfo.class).length); //} //cinfo = getClassInfo("org.jboss.test.classinfo.support.SimpleBean",loader); .......... protected TypeInfoFactory getTypeInfoFactory() { //return new IntrospectionTypeInfoFactory(); return new JavassistTypeInfoFactory(); } Testsuite: org.jboss.test.memorytests.ClassInfoMemoryTestCase Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.266 sec ------------- Standard Output --------------- +++oldloader =sun.misc.Launcher$AppClassLoader@16930e2 +++newloader =java.net.FactoryURLClassLoader@1f14ceb ------------- ---------------- --------------- Testcase: testSimpleBeanClassInfo took 0.266 sec sample 3: public class ClassInfoMemoryTestCase extends JBossMemoryTestCase { ......... //Class simpleBeanClass = loader.loadClass("org.jboss.test.classinfo.support.SimpleBean"); //Class simpleBeanInterface = loader.loadClass("org.jboss.test.classinfo.support.SimpleInterface"); ClassInfo cinfo = getClassInfo("org.jboss.test.classinfo.support.SimpleBean",loader); cinfo=null; //Test if the reference on ClassInfo is not too weak JVMTIInterface jvmti = new JVMTIInterface(); if (jvmti.isActive()) { jvmti.forceGC(); assertEquals(1,jvmti.getAllObjects(ClassInfo.class).length); } cinfo = getClassInfo("org.jboss.test.classinfo.support.SimpleBean",loader); .......... protected TypeInfoFactory getTypeInfoFactory() { return new IntrospectionTypeInfoFactory(); //return new JavassistTypeInfoFactory(); } Testsuite: org.jboss.test.memorytests.ClassInfoMemoryTestCase Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.266 sec ------------- Standard Output --------------- +++oldloader =sun.misc.Launcher$AppClassLoader@16930e2 +++newloader =java.net.FactoryURLClassLoader@1f14ceb ------------- ---------------- --------------- Testcase: testSimpleBeanClassInfo took 0.266 sec
-
21. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
adrian.brock Apr 20, 2006 7:12 AM (in response to clebert.suconic)The prototype javassist stuff doesn't understand scoped classloading.
It just uses the default classpool impl from javassist.
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=77746 -
22. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
bkeh12 Apr 20, 2006 9:14 AM (in response to clebert.suconic)Hi,adrian
I need to do the homework to understand well you said.
thank -
23. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
bkeh12 Apr 20, 2006 10:53 AM (in response to clebert.suconic)Hi,adrian
Forgives me to ask a stupid question.
Is org.jboss.reflect.plugins.ClassInfoImpl$UnknownClassInfo Strong Reference ?
Can it produce memory leaks on redeployment ?//Test if the reference on ClassInfo is not too weak JVMTIInterface jvmti = new JVMTIInterface(); if (jvmti.isActive()) { jvmti.forceGC(); assertEquals(1,jvmti.getAllObjects(ClassInfo.class).length); //is org.jboss.reflect.plugins.ClassInfoImpl$UnknownClassInfo Strong Reference ? } public class ClassInfoImpl extends InheritableAnnotationHolder implements ClassInfo { ....... /** Marker for generation */ static final ClassInfo UNKNOWN_CLASS = new UnknownClassInfo(); ....... static class UnknownClassInfo implements ClassInfo //static inner class { ....... } }
thank -
24. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
clebert.suconic Apr 20, 2006 11:54 PM (in response to clebert.suconic)This is about your three samples. three messages ago.
More specifically in your first sample.
The assertion is not about a memory leak. It's more if the reference is not too weak, havng something being released sooner than expected.
During my tests I didn't find that situation happening. What was your change that made this happen. This was not clear from your example. -
25. Re: JBMICROCONT-74 - Testcases for redeployments using JVMTI
bkeh12 Apr 21, 2006 2:53 AM (in response to clebert.suconic)The assertion is not about a memory leak. It's more if the reference is not too weak, havng something being released sooner than expected.
the ClassInfoImpl$UnknownClassInfo can be released.
Sorry this is my mistake...:-)