Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JBoss Request HashMap creates infinite loop

 
Mohan Ramamoorthy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic