eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
159 stars 109 forks source link

java.util.ConcurrentModificationException occurred when upgrade JDK from 8 to 11 #5236

Closed charlycong closed 1 year ago

charlycong commented 1 year ago

org.apache.jsp.errorPage._500_jsp _jspService (,,) ERROR: null java.util.ConcurrentModificationException at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1135) at com.sun.faces.util.Util.isNestedInIterator(Util.java:1745) at com.sun.faces.facelets.component.UIRepeat.keepSaved(UIRepeat.java:440) at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:1055) at com.lisj.jsf.components.ForEachComponent.encodeChildren(ForEachComponent.java:55) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1648) at com.lisj.jsf.components.ForEachComponent.encodeAll(ForEachComponent.java:47) at javax.faces.render.Renderer.encodeChildren(Renderer.java:152) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:571) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1648) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:461) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199) at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)

melloware commented 1 year ago

You didn't mention your version of Mojarra?

melloware commented 1 year ago

@BalusC I believe the issue might be in LRUMap because its being used to cache patterns etc for the isNestIterator. I am guessing it either has to be synchronized or LRUMap needs to extend ConcurrentLinkedHashMap instead of LinkedHashMap.

See: https://github.com/ben-manes/concurrentlinkedhashmap

BalusC commented 1 year ago

It has indeed highlighted an existing unexpected problem and inefficiency. See PR.

Do note that this is not related to the JDK upgrade per se. It was more likely coincidental.