High CPU due to Richfaces HashMap.get() infinite loop
Environment
- JBoss Enterprise Application Platform (EAP)
- Richfaces
Issue
- An application running on a 3 node cluster after running normally for some time, suddenly one node CPU spikes to 80% and stays like that.
- The threads using CPU have stack traces like the following:
"http-0.0.0.0-8080-1" daemon prio=10 tid=0x00002aaaaf78a000 nid=0x27ff runnable [0x0000000049fae000]
java.lang.Thread.State: RUNNABLE
at java.util.HashMap.get(HashMap.java:303)
at org.ajax4jsf.component.UIDataAdaptor.restoreChildState(UIDataAdaptor.java:965)
at org.ajax4jsf.component.UIDataAdaptor.restoreChildState(UIDataAdaptor.java:984)
at org.ajax4jsf.component.UIDataAdaptor.restoreChildState(UIDataAdaptor.java:943)
at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:361)
at org.ajax4jsf.component.UIDataAdaptor.iterate(UIDataAdaptor.java:1029)
at org.ajax4jsf.component.UIDataAdaptor.encodeAjaxChild(UIDataAdaptor.java:496)
...
Resolution
- The fix has been applied to the latest Richfaces supported version of 3.3.1.SP2 which can be downloaded from This content is not included.JBoss Web Framework Kit 1.1.0 in the Customer Support Portal
- A workaround is to enable state serialization as follows in the web deployment descriptor web.xml :
<context-param>
<param-name>org.ajax4jsf.SERIALIZE_SERVER_STATE</param-name>
<param-value>true</param-value>
</context-param>
- There is a performance cost for enabling state serialization which may or may not be acceptable.
Root Cause
- Content from issues.jboss.org is not included.RF-7248
- See High CPU due to multiple Java threads accessing HashMap simultaneously
Diagnostic Steps
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.