[ 
https://issues.apache.org/jira/browse/BEANUTILS-509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633937#comment-16633937
 ] 

Akshay Gehi commented on BEANUTILS-509:
---------------------------------------

I see from your log files that you are using WrapDynaBean 
{code:java}
"https-executor-threads - 83" #731 prio=5 os_prio=0 tid=0x00007fefa4367000 
nid=0x4234 runnable [0x00007fef2a56c000]
 java.lang.Thread.State: RUNNABLE
 at java.util.WeakHashMap.get(WeakHashMap.java:403)
 at 
org.apache.commons.beanutils.WrapDynaClass.createDynaClass(WrapDynaClass.java:425)
 at 
org.apache.commons.beanutils.WrapDynaClass.createDynaClass(WrapDynaClass.java:404)
 at 
org.apache.commons.beanutils.WrapDynaBean.getDynaClass(WrapDynaBean.java:230)
 at org.apache.commons.beanutils.WrapDynaBean.<init>(WrapDynaBean.java:79)
 at org.apache.commons.beanutils.WrapDynaBean.<init>(WrapDynaBean.java:61){code}
A workaround could be the following:

Use WrapDynaBean's 2 argument constructor and pass a cached instance of 
WrapDynaClass yourself. Avoid calling createDynaClass

 
{code:java}
public WrapDynaBean(final Object instance, final WrapDynaClass cls) {
          this.instance = instance;
          this.dynaClass = (cls != null) ? cls : (WrapDynaClass) getDynaClass();
}
{code}
 

> WeakHashmap enters into infinite loop in WrapDynaClass.java
> -----------------------------------------------------------
>
>                 Key: BEANUTILS-509
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-509
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: DynaBean
>    Affects Versions: 1.8.2
>            Reporter: sunil
>            Priority: Major
>         Attachments: console.log.backup
>
>
> We noticed that our application was using too much of CPU , all the 6 cores 
> were used. 
> On capturing the thread dump we saw that large number of threads were in the 
> running state and in :
> at java.util.WeakHashMap.get(WeakHashMap.java:403)
>  at 
> org.apache.commons.beanutils.WrapDynaClass.createDynaClass(WrapDynaClass.java:425)
>  
> So we are suspecting that the thread has entered into indefinite while loop 
> and hogging all the CPU resources.
> I have attached the thread dump for reference.  
>  
> what is the solution for this issue?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to