javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2535

UIComponent not thread safe use of facescontext Attributes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      When using @viewScoped beans, if a user post multiple simultaneous requests to the bean there are multiple threads working on the same managed bean.
      This causes an issue with the UIComponent class, there in the popComponentFromEL method is an unsafe get() call to a hashmap.

      When the server is under a heavy load then some threads get stuck in an infinite loop in the get() method of the Hashmap implementation.

      Is this a bug or it is a design choice not to synchronize the access to the contextAttributes hashmap?

      details:
      Weblogic 10.3.4
      Jsf 2.0.6
      jvm Oracle JRockit(R) R28.1.0-123-138454-1.6.0_20-20101014-1350-linux-x86_64

      – problem method in UIComponent.class ----

      private static ComponentStack _getComponentELStack(String keyName, Map<Object, Object> contextAttributes)
      {
      ComponentStack elStack = (ComponentStack)contextAttributes.get(keyName); <-- unsafe hashmap access, need to synchronize access?

      if (elStack == null)

      { elStack = new ComponentStack(); contextAttributes.put(keyName, elStack); }

      return elStack;
      }

      ------- stack dump of stuck thread -----

      "[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'" id=26 idx=0x7c tid=18549 prio=1 alive, native_blocked, daemon

      at javax/faces/component/UIComponent.popComponentFromEL(UIComponent.java:1821)[optimized]

      at javax/faces/component/UIComponent.popComponentFromEL(UIComponent.java:1846)[inlined]

      at javax/faces/component/UIComponentBase.encodeEnd(UIComponentBase.java:884)[optimized]

      at com/sun/faces/renderkit/html_basic/HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:308)[inlined]

      at com/sun/faces/renderkit/html_basic/GroupRenderer.encodeChildren(GroupRenderer.java:101)[optimized]

      at javax/faces/component/UIComponentBase.encodeChildren(UIComponentBase.java:849)[optimized]

      at javax/faces/component/UIComponent.encodeAll(UIComponent.java:1648)[optimized]

      at com/sun/faces/renderkit/html_basic/CompositeRenderer.encodeChildren(CompositeRenderer.java:75)[optimized]

      at javax/faces/component/UIComponentBase.encodeChildren(UIComponentBase.java:849)[optimized]

      at com/sun/faces/renderkit/html_basic/HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:300)[inlined]

      at com/sun/faces/renderkit/html_basic/GroupRenderer.encodeChildren(GroupRenderer.java:101)[optimized]

      at javax/faces/component/UIComponentBase.encodeChildren(UIComponentBase.java:849)[optimized]

      at com/sun/faces/renderkit/html_basic/HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:300)[inlined]

      at com/sun/faces/renderkit/html_basic/GroupRenderer.encodeChildren(GroupRenderer.java:101)[optimized]

      at javax/faces/component/UIComponentBase.encodeChildren(UIComponentBase.java:849)[optimized]

      at javax/faces/component/UIComponent.encodeAll(UIComponent.java:1648)[optimized]

      at javax/faces/render/Renderer.encodeChildren(Renderer.java:164)[optimized]

      at javax/faces/component/UIComponentBase.encodeChildren(UIComponentBase.java:849)[optimized]

      at javax/faces/component/UIComponent.encodeAll(UIComponent.java:1648)[optimized]

      at javax/faces/component/UIComponent.encodeAll(UIComponent.java:1651)[optimized]

      at javax/faces/component/UIComponent.encodeAll(UIComponent.java:1651)[optimized]

      at com/sun/faces/application/view/FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:395)[optimized]

      at com/sun/faces/application/view/MultiViewHandler.renderView(MultiViewHandler.java:127)[inlined]

      at com/sun/faces/lifecycle/RenderResponsePhase.execute(RenderResponsePhase.java:117)[optimized]

      at com/sun/faces/lifecycle/Phase.doPhase(Phase.java:97)[optimized]

      at com/sun/faces/lifecycle/LifecycleImpl.render(LifecycleImpl.java:135)[optimized]

      at javax/faces/webapp/FacesServlet.service(FacesServlet.java:309)[optimized]

      at weblogic/servlet/internal/StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)[optimized]

      at weblogic/servlet/internal/StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)[inlined]

      at weblogic/servlet/internal/ServletStubImpl.execute(ServletStubImpl.java:300)[optimized]

      at weblogic/servlet/internal/TailFilter.doFilter(TailFilter.java:26)[optimized]

      at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]

      at org/primefaces/webapp/filter/FileUploadFilter.doFilter(FileUploadFilter.java:79)[optimized]

      at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]

      at nl/sidn/web/support/em/EntityManagerFilter.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChain;)V(Unknown Source)

      at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]

      at org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)[optimized]

      at org/springframework/security/intercept/web/FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)[inlined]

      at org/springframework/security/intercept/web/FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)[optimized]

      at org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)[optimized]

      at org/springframework/security/ui/ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)

      at org/springframework/security/ui/SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)[optimized]

      at org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)[optimized]

      at org/springframework/security/providers/anonymous/AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)[optimized]

      at org/springframework/security/ui/SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)[optimized]

      at org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)[optimized]

      at org/springframework/security/ui/logout/LogoutFilter.doFilterHttp(LogoutFilter.java:89)

      at org/springframework/security/ui/SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)[optimized]

      at org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)[optimized]

      at org/springframework/security/ui/preauth/AbstractPreAuthenticatedProcessingFilter.doFilterHttp(AbstractPreAuthenticatedProcessingFilter.java:69)[optimized]

      at org/springframework/security/ui/SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)[optimized]

      at org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)[optimized]

      at org/springframework/security/context/HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)[optimized]

      at org/springframework/security/ui/SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)[optimized]

      at org/springframework/security/util/FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)[optimized]

      at org/springframework/security/util/FilterChainProxy.doFilter(FilterChainProxy.java:175)[optimized]

      at org/springframework/web/filter/DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)[optimized]

      at org/springframework/web/filter/DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

      at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]

      at nl/sidn/web/security/xsrf/CSRFFilter.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChain;)V(Unknown Source)[optimized]

      at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]

      at weblogic/servlet/internal/RequestEventsFilter.doFilter(RequestEventsFilter.java:27)[optimized]

      at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[inlined]

      at weblogic/servlet/internal/WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)[inlined]

      at weblogic/servlet/internal/WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)[optimized]

      at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)[optimized]

      at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:120)[inlined]

      at weblogic/servlet/internal/WebAppServletContext.securedExecute(WebAppServletContext.java:2277)[inlined]

      at weblogic/servlet/internal/WebAppServletContext.execute(WebAppServletContext.java:2183)[optimized]

      at weblogic/servlet/internal/ServletRequestImpl.run(ServletRequestImpl.java:1454)[optimized]

      at weblogic/work/ExecuteThread.execute(ExecuteThread.java:207)[optimized]

      at weblogic/work/ExecuteThread.run(ExecuteThread.java:176)

      at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

        Issue Links

          Activity

          crcerror created issue -
          Manfred Riem made changes -
          Field Original Value New Value
          Link This issue is duplicated by JAVASERVERFACES-2544 [ JAVASERVERFACES-2544 ]
          Manfred Riem made changes -
          Assignee Manfred Riem [ mriem ]
          Manfred Riem made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Invalid [ 6 ]
          Manfred Riem made changes -
          Resolution Invalid [ 6 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Manfred Riem made changes -
          Affects Version/s 2.0.6 [ 14844 ]
          Manfred Riem made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Invalid [ 6 ]

            People

            • Assignee:
              Manfred Riem
              Reporter:
              crcerror
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: