[
https://issues.apache.org/jira/browse/BEANUTILS-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12626594#action_12626594
]
Niall Pemberton commented on BEANUTILS-291:
-------------------------------------------
Jörg Schaible found a problem with the JRockit JDK and the
MappedPropertyDescriptor:
http://markmail.org/message/4mfxqesmxcvleqll
It appears that with the JRockit JDK the (weak) reference to the class is being
lost, even though in that test there is still a strong reference to the class
(and class loader). I couldn't find a valid link to download the JRockit JDK,
but I can re-create the same exception by adding a test that removes all strong
references to the class. I didn't really expect this exception to ever get
thrown, but since this has occured I've added code to try and re-create the
class reference (and a test for it):
http://svn.apache.org/viewvc?view=rev&revision=689831
> Circular Reference on WeakHashMap
> ---------------------------------
>
> Key: BEANUTILS-291
> URL: https://issues.apache.org/jira/browse/BEANUTILS-291
> Project: Commons BeanUtils
> Issue Type: Bug
> Components: Bean / Property Utils
> Affects Versions: 1.8.0-BETA
> Reporter: Niall Pemberton
> Assignee: Niall Pemberton
> Fix For: 1.8.0
>
> Attachments: BEANUTILS-291-FixMemoryLeaks-v2.patch,
> memoryLeakTests-new.zip, PropertyUtilsBean.java,
> ThreadIsolationAndTestImprovement2.patch
>
>
> Clebert Suconic wrote on the [EMAIL PROTECTED] list ....
> (see http://tinyurl.com/2a9gan)
> I have been investigating WeakHashMaps on BeanUtils 1.8 as part of a
> investigation on this:
> http://jira.jboss.com/jira/browse/JBAS-2299
> (Which is not actually an issue with JBAS, but an issue when using BeanUtils
> as part of the classPath).
> There is a circular reference on the WeakHashMap, The WeakHashMap will have
> the ClassLoader as the key, and it will have a reference back to the Key from
> one of the Reflection objects. This doesn't work! (Please.. no discussions
> about this point.. if you don't believe me, do some testing with simple stuff
> before discussing this and come back to me only after that)
> [EMAIL PROTECTED]
> !--- [EMAIL PROTECTED]
> !--- !--- class sun.reflect.GeneratedConstructorAccessor38
> !--- !--- !--- [Ljava.lang.Object;@10800875
> !--- !--- !--- !--- [EMAIL PROTECTED]
> !--- !--- !--- !--- !--- [EMAIL PROTECTED]
> !--- !--- !--- !--- !--- !--- class sun.reflect.GeneratedConstructorAccessor38
> !--- !--- !--- !--- !--- !--- !--- class java.lang.Class
> !--- !--- !--- !--- !--- !--- !--- !--- [EMAIL PROTECTED]
> !--- !--- !--- !--- !--- !--- !--- !--- !--- [EMAIL PROTECTED]
> !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- [EMAIL PROTECTED]
> !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- [EMAIL PROTECTED]
> !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !---
> [Ljava.util.HashMap$Entry;@28236766
> !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- [EMAIL
> PROTECTED]
> !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- [EMAIL
> PROTECTED]
> !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !--- !---
> [EMAIL PROTECTED]
> !--- !--- !--- !--- !--- !--- !--- !--- !-- -!--- !--- !--- !--- !--- !---
> !---FieldReference private java.lang.Object [EMAIL PROTECTED] Detail
> I don't know if I'm preaching to the choir, but just in case this is new
> information to someone... you should aways keep Reflection referenced as
> SoftReferences (if you really have to). Reflection is aways a new object so a
> WeakReference is too weak.
> On JBossSerialization I have solved this using an interesting way. I called
> it PersistentReference. I'm using SoftReferences, and keeping the information
> to recreate it case the SoftReference is cleared:
> http://fisheye.jboss.org/browse/JBoss/jboss-serialization/src/org/jboss/serial/references/PersistentReference.java?r=1.3
> And also... you guys should write a testcase to validate if the Caching is
> being cleared. (I don't know if you have one).
> http://anonsvn.jboss.org/repos/jbossserialization/trunk/tests/org/jboss/serial/memory/MemoryLeakTestCase.java
> You don't need to use the jboss-profiler API for this.. just create a
> WeakReference to a new ClassLoader, and validate if it was released at the
> end after some exercizing some code on this caching. You will
> probably need to fill your memory almost to 100% on the test as SoftReference
> are only gone when the memory is low.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.