Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3216

check concurrency problems over static maps holding class metadata information (_ComponentAttributesMap and MetaRulesetImpl)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.11, 2.0.8, 2.1.2
    • Component/s: JSR-314
    • Labels:
      None

      Description

      There is something suspicious about these two maps:

      javax.faces.component._ComponentAttributesMap

      // Cache for component property descriptors
      private static Map<Class<?>, Map<String, PropertyDescriptor>> _propertyDescriptorCache =
      new WeakHashMap<Class<?>, Map<String, PropertyDescriptor>>();

      org.apache.myfaces.view.facelets.tag

      private final static WeakHashMap<ClassLoader, Map<String, MetadataTarget>> _metadata
      = new WeakHashMap<ClassLoader, Map<String, MetadataTarget>>();

      Both maps do something similar, cache PropertyDescriptor and other information that is unique per class. The problem is WeakHashMap is not thread safe, so in both cases there is a potential risk of throw exceptions when calling "put" method under high load.

      The solution is put proper synchronized blocks when calling to put is done, just like FactoryFinder does.

      Reported stack trace by Rajadurai_p. See http://markmail.org/message/4md2rsiii5mjhvcr?q=MyFaces+-+Thread+issues+under+High+load for details:

      Hi,

      we are facing problems in MyFaces framework under high load. Bulk of the
      application container threads (weblogic) are stuck upon a same stack trace.
      I have pasted a sample stack trace below. Kindly help.

      We use JSF 1.2, MyFaces 1.2.9, Tomahawk 1.1.9 & RichFaces 3.3.3.

      java.beans.PropertyDescriptor.getReadMethod(PropertyDescriptor.java:158)

      javax.faces.component._ComponentAttributesMap.getComponentProperty(_ComponentAttributesMap.java:382)

      javax.faces.component._ComponentAttributesMap.get(_ComponentAttributesMap.java:227)

      org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils.renderHTMLAttribute(HtmlRendererUtils.java:584)

      org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils.renderHTMLAttributes(HtmlRendererUtils.java:598)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeBegin(HtmlTagRenderer.java:73)
      javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:600)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:525)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:528)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)
      org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
      org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)

      org.richfaces.renderkit.AbstractGridRenderer.encodeOneRow(AbstractGridRenderer.java:96)

      org.richfaces.renderkit.AbstractRowsRenderer.process(AbstractRowsRenderer.java:83)
      org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:101)
      org.ajax4jsf.component.UIDataAdaptorBase.walk(UIDataAdaptorBase.java:1156)

      org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:104)

      org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:88)

      org.richfaces.renderkit.AbstractRowsRenderer.encodeChildren(AbstractRowsRenderer.java:137)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)
      org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
      org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)

      org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:78)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:528)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:250)

      com.sun.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:64)
      com.sun.facelets.component.UIRepeat.process(UIRepeat.java:423)
      com.sun.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:684)
      org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
      org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)

      org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:200)

      org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:195)
      org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)
      org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
      org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
      org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:279)
      org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)

      org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:78)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:528)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:528)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:532)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:528)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:528)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:528)

      org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

      org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)

      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:627)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:250)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:257)
      com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:594)

      org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)

      org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)

      org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
      org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:187)

      weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)

      weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
      weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

      org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164)
      org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)

      org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)

      org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:407)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

      org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:384)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

      com.xxx.yyy.zzz.CookieCartCountFilter.doFilter(CookieCartCountFilter.java:69)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

      com.xxx.yyy.zzz.webservice.onesite.OneSiteCacheFilter.doFilter(OneSiteCacheFilter.java:388)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      com.xxx.yyy.zzz.util.CachingFilter.doFilter(CachingFilter.java:143)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      com.xxx.yyy.zzz.util.JsessionidFilter.doFilter(JsessionidFilter.java:43)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

      com.xxx.yyy.zzz.util.SessionCookieSupportFilter.doFilter(SessionCookieSupportFilter.java:180)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

      de.hybris.platform.util.RootRequestFilter.doFilter(RootRequestFilter.java:741)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

      weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:26)
      weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

      weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3229)

      weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)

      weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2002)

      weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1908)

      weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1362)
      weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

        Attachments

        1. MYFACES-3216-1-jsf12.patch
          1 kB
          Leonardo Uribe
        2. MYFACES-3216-1-jsf20.patch
          3 kB
          Leonardo Uribe
        3. MYFACES-3216-1-jsf21.patch
          3 kB
          Leonardo Uribe

          Activity

            People

            • Assignee:
              lu4242 Leonardo Uribe
              Reporter:
              lu4242 Leonardo Uribe
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: