Stuck thread at UIComponent.popComponentFromEL

My application uses JSF 2.1 with PrimeFaces. Recently, very high CPU Utilization was observed because of some stuck threads. The stuck thread dump for all stuck threads pointed to javax.faces.component.UIComponent.popComponentFromEL like below:

javax.faces.component.UIComponent.popComponentFromEL(UIComponent.java:1934)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1633)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
org.primefaces.component.api.UIData.visitRows(UIData.java:741)
org.primefaces.component.api.UIData.visitTree(UIData.java:656)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
org.primefaces.component.accordionpanel.AccordionPanel.visitTree(AccordionPanel.java:371)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIForm.visitTree(UIForm.java:371)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
com.sun.faces.application.view.StateManagementStrategyImpl.findComponent(StateManagementStrategyImpl.java:440)
com.sun.faces.application.view.StateManagementStrategyImpl.restoreDynamicRemove(StateManagementStrategyImpl.java:412)
com.sun.faces.application.view.StateManagementStrategyImpl.restoreDynamicActions(StateManagementStrategyImpl.java:317)
com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:281)
com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:188)
com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:453)
com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:77)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
com.ultimatix.bgc.framework.GBGCSessionControllerFilter.doFilter(GBGCSessionControllerFilter.java:90)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
com.ultimatix.framework.jsf.util.ForcedLoginFilter.doFilter(ForcedLoginFilter.java:505)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
com.ultimatix.framework.jsf.util.IndexFilter.doFilter(IndexFilter.java:338)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
com.ultimatix.framework.jsf.util.SecurityInterceptor.doFilter(SecurityInterceptor.java:40)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
weblogic.work.ExecuteThread.run(ExecuteThread.java:176)

How is this caused and how can I solve it?


As per Mojarra issue 2722 this will happen when you incorrectly bind component instances to a bean property of a managed bean which is not request scoped, but in a broader scope.

<x:someComponent binding="#{viewOrSessionOrApplicationScopedBean.component}" />

Fix the code accordingly that this never happens. Components are inherently request scoped and may absolutely not be shared across multiple requests. See also JSF 2.0 specitication chapter 3.1.5:

3.1.5 Component Bindings

...

Component bindings are often used in conjunction with JavaBeans that are dynamically instantiated via the Managed Bean Creation facility (see Section 5.8.1 “VariableResolver and the Default VariableResolver”). It is strongly recommend that application developers place managed beans that are pointed at by component binding expressions in “request” scope. This is because placing it in session or application scope would require thread-safety, since UIComponent instances depends on running inside of a single thread. There are also potentially negative impacts on memory management when placing a component binding in “session” scope.

See also:

  • How does the 'binding' attribute work in JSF? When and how should it be used?
  • What is component binding in JSF? When it is preferred to be used?
  • 链接地址: http://www.djcxy.com/p/85000.html

    上一篇: 使用两个自旋向量中的点对球体上的x,y,z坐标进行插值?

    下一篇: 在UIComponent.popComponentFromEL处停滞线程