javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-1988

CompositeComponentTagHandler.createComponent is not thread safe

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.6, 2.0.7, 2.1.2, 2.1.4, 2.1.5, 2.2.0-m01
    • Component/s: None
    • Labels:
      None
    • Status Whiteboard:
      Hide

      size_medium importance_medium

      Show
      size_medium importance_medium

      Description

      Using jmeter to simulate many client request I got the following exception:

      Caused by: java.lang.ArrayIndexOutOfBoundsException: 7
      at java.util.ArrayList.add(ArrayList.java:352)
      at javax.faces.component.ComponentStateHelper.add(ComponentStateHelper.java:220)
      at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:2290)
      at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:2151)
      at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler$CompositeComponentRule$LiteralAttributeMetadata.applyMetadata(CompositeComponentTagHandler.java:564)
      at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81)
      at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:129)
      at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102)
      at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.setAttributes(CompositeComponentTagHandler.java:228)
      at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyNextHandler(CompositeComponentTagHandler.java:181)
      at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
      at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
      at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
      at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
      at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
      at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
      at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
      at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
      at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
      at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
      at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
      at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
      at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:82)
      at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:744)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
      ... 15 more

      First I verified that all client threads use distinct values/instances
      of FacesContext, HTTPSession, ViewRoot.
      But there was a single UIComponent concurrently used in multiple ViewRoots.

      Debugging of all threads gave me the following hint:
      CompositeComponentTagHandler.createComponent is not thread safe and returned the same object instance for different ViewRoots (member variable cc is accessed without synchronized block)

        Activity

        Hide
        Ed Burns added a comment -

        This zip contains two patches, both for the MOJARRA_2_1X_ROLLING branch. One that rolls back the fix for 1988. The other applies a new fix to the rolled back workarea.

        Show
        Ed Burns added a comment - This zip contains two patches, both for the MOJARRA_2_1X_ROLLING branch. One that rolls back the fix for 1988. The other applies a new fix to the rolled back workarea.
        Hide
        Ed Burns added a comment -

        Rework the fix to not cause JAVASERVERFACES-2232.

        Show
        Ed Burns added a comment - Rework the fix to not cause JAVASERVERFACES-2232 .
        Hide
        Ed Burns added a comment -

        Committed fix to 2.1 branch in r 9412.

        Committed small revision of fix to 2.1 branch in r 9414.

        Show
        Ed Burns added a comment - Committed fix to 2.1 branch in r 9412. Committed small revision of fix to 2.1 branch in r 9414.
        Hide
        Ed Burns added a comment -

        Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentTagHandlerDelegateImpl.java
        Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/CompositeComponentTagHandler.java
        Adding jsf-test/JAVASERVERFACES-2232
        Adding jsf-test/JAVASERVERFACES-2232/build.xml
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/pom.xml
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun/faces
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun/faces/regression
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun/faces/regression/i_mojarra_2232_war
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun/faces/regression/i_mojarra_2232_war/JavaTopLevelComponent.java
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/resources
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/WEB-INF
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/WEB-INF/web.xml
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/i_mojarra_2232.xhtml
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/resources
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/resources/ezcomp
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/resources/ezcomp/i_mojarra_2232_cc.xhtml
        Sending jsf-test/build.xml
        Transmitting file data ....
        Committed revision 9418.

        Committed to trunk.

        Show
        Ed Burns added a comment - Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentTagHandlerDelegateImpl.java Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/CompositeComponentTagHandler.java Adding jsf-test/ JAVASERVERFACES-2232 Adding jsf-test/ JAVASERVERFACES-2232 /build.xml Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/pom.xml Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun/faces Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun/faces/regression Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun/faces/regression/i_mojarra_2232_war Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun/faces/regression/i_mojarra_2232_war/JavaTopLevelComponent.java Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/resources Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/WEB-INF Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/WEB-INF/web.xml Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/i_mojarra_2232.xhtml Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/resources Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/resources/ezcomp Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/resources/ezcomp/i_mojarra_2232_cc.xhtml Sending jsf-test/build.xml Transmitting file data .... Committed revision 9418. Committed to trunk.
        Hide
        Ed Burns added a comment -

        Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentTagHandlerDelegateImpl.java
        Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/CompositeComponentTagHandler.java
        Adding jsf-test/JAVASERVERFACES-2232
        Adding jsf-test/JAVASERVERFACES-2232/build.xml
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/pom.xml
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun/faces
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun/faces/regression
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun/faces/regression/i_mojarra_2232_war
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/java/com/sun/faces/regression/i_mojarra_2232_war/JavaTopLevelComponent.java
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/resources
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/WEB-INF
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/WEB-INF/web.xml
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/i_mojarra_2232.xhtml
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/resources
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/resources/ezcomp
        Adding jsf-test/JAVASERVERFACES-2232/i_mojarra_2232_war/src/main/webapp/resources/ezcomp/i_mojarra_2232_cc.xhtml
        Sending jsf-test/build.xml
        Transmitting file data .........
        Committed revision 9421.

        Now committed to 2.0 branch.

        This means the regression has been fixed on all the JSF2 lines.

        Show
        Ed Burns added a comment - Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentTagHandlerDelegateImpl.java Sending jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/CompositeComponentTagHandler.java Adding jsf-test/ JAVASERVERFACES-2232 Adding jsf-test/ JAVASERVERFACES-2232 /build.xml Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/pom.xml Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun/faces Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun/faces/regression Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun/faces/regression/i_mojarra_2232_war Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/java/com/sun/faces/regression/i_mojarra_2232_war/JavaTopLevelComponent.java Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/resources Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/WEB-INF Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/WEB-INF/web.xml Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/i_mojarra_2232.xhtml Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/resources Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/resources/ezcomp Adding jsf-test/ JAVASERVERFACES-2232 /i_mojarra_2232_war/src/main/webapp/resources/ezcomp/i_mojarra_2232_cc.xhtml Sending jsf-test/build.xml Transmitting file data ......... Committed revision 9421. Now committed to 2.0 branch. This means the regression has been fixed on all the JSF2 lines.

          People

          • Assignee:
            rogerk
            Reporter:
            alexschmidt
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: