File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes JBoss Request HashMap creates infinite loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBoss Request HashMap creates infinite loop" Watch "JBoss Request HashMap creates infinite loop" New topic
Author

JBoss Request HashMap creates infinite loop

Mohan Ramamoorthy
Greenhorn

Joined: Jan 31, 2006
Posts: 9
Hi,

We have deployed Richfaces web application in JBOSS-EAP-4.3. Due to the following exception the CPU spikes to 90%.

Thread: http-10.20.81.200-17180-31 : priority:5, demon:true, threadId:337, threadState:RUNNABLE, lockName:null
java.util.HashMap.get(HashMap.java:305)
org.apache.catalina.connector.Request.getAttribute(Request.java:878)
org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)
com.sun.faces.application.WebappLifecycleListener.attributeReplaced(WebappLifecycleListener.java:168)
com.sun.faces.config.ConfigureListener.attributeReplaced(ConfigureListener.java:318)
org.apache.catalina.connector.Request.setAttribute(Request.java:1435)
org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:503)
javax.servlet.ServletRequestWrapper.setAttribute(ServletRequestWrapper.java:284)
com.sun.faces.context.RequestMap.put(ExternalContextImpl.java:1087)
org.ajax4jsf.event.AjaxPhaseListener.afterPhase(AjaxPhaseListener.java:81)
com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

After the initial analysis, we have found out that the “attributes” hashmap in org.apache.catalina.connector.Request is causing the issue. Since the hashmap is not thread safe, it ends up in an infinite loop. Session (org.apache.catalina.session.StandardSession) also has the similar implementation of “attributes” but it is made as concurrent hash map to avoid the concurrency issue. Is there any reason why the Request#attributes hashmap is not made as concurrent hash map ? Also is there any workaround available to fix this issue ?

Can anyone help us in resolving this issue.


Regards,
Mohan R
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBoss Request HashMap creates infinite loop