-
Type: Bug
-
Status: Resolved
-
Priority: Critical
-
Resolution: Fixed
-
Affects Version/s: 5.3.2, 5.4.2, 5.5
-
Fix Version/s: 5.4.2-HF16, 5.5.0-HF02, 5.6-RC1, 5.6
-
Component/s: Core VCS
-
Tags:
On high concurrency access to ComplexTypeImpl.getField can lead to infinite loop on HashMap.get.
The result is that all thread will be blocked in HashMap.get consuming all CPU without end.
Looking at a thread dump will show many threads like this
ajp-XXXXX-8009-49" daemon prio=10 tid=0x000000005052a800 nid=0x31c1 runnable [0x0000000048263000]
java.lang.Thread.State: RUNNABLE
at java.util.HashMap.get(HashMap.java:303)
at org.nuxeo.ecm.core.schema.types.ComplexTypeImpl.getField(ComplexTypeImpl.java:103)
at org.nuxeo.ecm.core.schema.types.CompositeTypeImpl.getField(CompositeTypeImpl.java:123)
at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.makeProperties(SQLSession.java:846)
at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.makeProperty(SQLSession.java:823)
at org.nuxeo.ecm.core.storage.sql.coremodel.SQLComplexProperty.getProperty(SQLComplexProperty.java:119)
at org.nuxeo.ecm.core.storage.sql.coremodel.SQLComplexProperty.setPropertyValue(SQLComplexProperty.java:209)
at org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocumentLive.writeDocumentPart(SQLDocumentLive.java:171)
at org.nuxeo.ecm.core.api.AbstractSession.writeModel(AbstractSession.java:495)
at org.nuxeo.ecm.core.api.AbstractSession.createDocument(AbstractSession.java:816)
at org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.createDocument(DocumentManagerBean.java:261)
This happens because HashMap is not thread safe and access should be synchronized.