ICEfaces
  1. ICEfaces
  2. ICE-3313

Concurrent Modification Exception with many pushes in portlet environment

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.1
    • Fix Version/s: 1.7.2
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      Liferay 4.4.1, Jboss 4.2.2

      Description

      The following exception is thrown when there are many server initiated updates occurring at the same time from different portlets:

      2008-06-15 16:54:48,707 ERROR
      [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/slp-gqast1.com-web].[Persistent
      Faces Servlet]] Servlet.service() for servlet Persi
      stent Faces Servlet threw exception
      java.util.ConcurrentModificationException
              at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
              at java.util.HashMap$EntryIterator.next(HashMap.java:883)
              at java.util.HashMap$EntryIterator.next(HashMap.java:881)
              at
      com.icesoft.faces.context.BridgeExternalContext.collectBundles(BridgeExternalContext.java:207)
              at com.icesoft.faces.context.View.switchToPushMode(View.java:142)
              at
      com.icesoft.faces.webapp.http.core.MultiViewServer.service(MultiViewServer.java:57)
              at
      com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
              at
      com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
              at
      com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
              at
      com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
              at
      com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)
              at
      com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
              at
      com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
              at
      com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
              at
      com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:79)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at
      org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
              at
      org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
              at
      org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
              at
      com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:245)
              at
      com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:87)
              at
      com.icesoft.faces.webapp.http.portlet.MainPortlet.doInclude(MainPortlet.java:122)
              at
      com.icesoft.faces.webapp.http.portlet.MainPortlet.doView(MainPortlet.java:55)
              at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
              at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
              at
      com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:102)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at
      org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
              at
      org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
              at
      org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
              at com.liferay.portlet.CachePortlet._invoke(CachePortlet.java:408)
              at com.liferay.portlet.CachePortlet.render(CachePortlet.java:251)
              at
      org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1345)
              at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              at
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
              at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
              at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)

        Activity

        Tyler Johnson created issue -
        Tyler Johnson made changes -
        Field Original Value New Value
        Support Case References https://www.icesoft.ca:4443/supportilla/show_bug.cgi?id=4980
        Ken Fyten made changes -
        Assignee Priority P1
        Assignee Mircea Toma [ mircea.toma ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17194 Sat Jul 19 02:07:34 MDT 2008 mircea.toma ICE-3313 Copy entry set to avoid ConcurrentModificationException-s.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeExternalContext.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17195 Sat Jul 19 02:08:37 MDT 2008 mircea.toma ICE-3313 Copy entry set to avoid ConcurrentModificationException-s.
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/BridgeExternalContext.java
        Hide
        Mircea Toma added a comment -

        Copy entry set to avoid ConcurrentModificationException-s.

        Show
        Mircea Toma added a comment - Copy entry set to avoid ConcurrentModificationException-s.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.7.2 [ 10130 ]
        Resolution Fixed [ 1 ]
        Hide
        Ken Fyten added a comment -

        Customer believes that the supplied initial fix is not comprehensive enough. They have submitted a suggested solution which I will attach (they are ICEfaces Contributor's so we can use their code, etc.).

        Show
        Ken Fyten added a comment - Customer believes that the supplied initial fix is not comprehensive enough. They have submitted a suggested solution which I will attach (they are ICEfaces Contributor's so we can use their code, etc.).
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Ken Fyten added a comment -

        Comments from contributor:


        I have been able to fix the icefaces CMEs. Included in the attached icefacesMods.tar.gz file are the source files changed.

        Note that my changes are only good for JDK 1.5.

        What I've done is modified core/src/com/icesoft/faces/context/AbstractCopyingAttributeMap.java to extend ConcurrentHashMap instead of HashMap, and fixed the put and putAll methods to drop and remove keys with null values. With the exception of a contains method call for a key, this should be transparent to the rest of the Icefaces code.

        I can't recreate a CME after these changes.


        NOTE: To make this suitable for JDK 1.4 we will need to use the ConcurrentHashMap class from the JDK 1.4 Concurrent utils backport instead.

        Show
        Ken Fyten added a comment - Comments from contributor: I have been able to fix the icefaces CMEs. Included in the attached icefacesMods.tar.gz file are the source files changed. Note that my changes are only good for JDK 1.5. What I've done is modified core/src/com/icesoft/faces/context/AbstractCopyingAttributeMap.java to extend ConcurrentHashMap instead of HashMap, and fixed the put and putAll methods to drop and remove keys with null values. With the exception of a contains method call for a key, this should be transparent to the rest of the Icefaces code. I can't recreate a CME after these changes. NOTE: To make this suitable for JDK 1.4 we will need to use the ConcurrentHashMap class from the JDK 1.4 Concurrent utils backport instead.
        Ken Fyten made changes -
        Attachment icefacesMods.tar.gz [ 11130 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17207 Wed Jul 23 04:41:05 MDT 2008 mircea.toma ICE-3313 Synchronize request attribute map.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeExternalContext.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/ServletExternalContext.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/portlet/PortletExternalContext.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17208 Wed Jul 23 04:42:27 MDT 2008 mircea.toma ICE-3313 Synchronize request attribute map.
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/ServletExternalContext.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/webapp/http/portlet/PortletExternalContext.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/BridgeExternalContext.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17209 Wed Jul 23 04:45:12 MDT 2008 mircea.toma ICE-3313 Synchronize request attribute map.
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.7.1/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/ServletExternalContext.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.7.1/icefaces/core/src/com/icesoft/faces/webapp/http/portlet/PortletExternalContext.java
        Hide
        Mircea Toma added a comment -

        Synchronize request attribute map since its content is updated continuously by the framework.

        Show
        Mircea Toma added a comment - Synchronize request attribute map since its content is updated continuously by the framework.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Deryk Sinotte added a comment -

        The customer is concerned that the fix we applied does not solve the problem they are seeing. We need to review the fix in light of the customer's latest request.

        Show
        Deryk Sinotte added a comment - The customer is concerned that the fix we applied does not solve the problem they are seeing. We need to review the fix in light of the customer's latest request.
        Deryk Sinotte made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17290 Tue Aug 05 16:27:02 MDT 2008 mircea.toma ICE-3313 Synchronize map entries iteration. Synchronize code that could mutate View's state concurrently.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeExternalContext.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/AbstractCopyingAttributeMap.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/core/SingleViewServer.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/core/MultiViewServer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #17291 Tue Aug 05 16:27:24 MDT 2008 mircea.toma ICE-3313 Synchronize map entries iteration. Serialize code that can mutate View's state concurrently.
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/webapp/http/core/MultiViewServer.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/webapp/http/core/SingleViewServer.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/BridgeExternalContext.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/AbstractCopyingAttributeMap.java
        Hide
        Mircea Toma added a comment -

        Resolving issue until the proof to the contrary.

        Show
        Mircea Toma added a comment - Resolving issue until the proof to the contrary.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 1.7.2RC1 [ 10140 ]
        Fix Version/s 1.7.2 [ 10130 ]
        Ken Fyten made changes -
        Fix Version/s 1.7.2 [ 10130 ]
        Fix Version/s 1.7.2RC1 [ 10140 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Priority P1
        Assignee Mircea Toma [ mircea.toma ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: