Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Stuck thread at popComponentFromEL(UIComponent.java:2084) causing high cpu usage #4407

Open
DarthKD opened this issue Nov 12, 2019 · 1 comment

Comments

@DarthKD
Copy link

DarthKD commented Nov 12, 2019

Getting high CPU usage due to Multiple stuck threads at UIComponent.popComponentFromEL (UIComponent.java:2084)

Every thread refers to same line number in UIComponent.java at line 2084. Here is the snippet of thread dump.

javax.faces.component.UIComponent.popComponentFromEL(UIComponent.java:2084)
javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2326)
javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2314)
javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2314)
javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2314)
javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2314)
javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2314)
javax.faces.component.UIComponentBase.doPostAddProcessing(UIComponentBase.java:1986)
javax.faces.component.UIComponentBase.setParent(UIComponentBase.java:459)
javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:2772)
javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:2742)
com.sun.faces.facelets.tag.jsf.ComponentSupport.addComponent(ComponentSupport.java:527)
com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.addComponentToView(ComponentTagHandlerDelegateImpl.java:354)
com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.addComponentToView(ComponentTagHandlerDelegateImpl.java:337)
com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:222)
javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:135)
javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:96)
com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:224)
javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:96)
com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:94)
com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:88)
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:313)
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:372)
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:351)
com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:204)
com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:175)
com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:94)
com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:88)
com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:162)
com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:381)
com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:289)
com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:157)
com.ocpsoft.pretty.faces.application.PrettyViewHandler.restoreView(PrettyViewHandler.java:109)
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:204)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:133)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728)
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:470)
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395)
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316)
com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)

I tried the solution provided in below answer but there are many pages in which we have implemented component binding and it is not possible to change scope of every pages.
https://stackoverflow.com/questions/30093791/stuck-thread-at-uicomponent-popcomponentfromel

I removed below code from UIComponent.java file and it seems to be working.

for (UIComponent topComponent = componentELStack.peek();
     topComponent != this;
     topComponent = componentELStack.peek())
{
   topComponent.popComponentFromEL(context);
}

My question is if i remove the above code will it cause issue somewhere else?

@DarthKD
Copy link
Author

DarthKD commented Nov 12, 2019

As per JSF form/GitHub issue tracker suggestion also add SERIALIZE_SERVER_STATE parameter in web.xml

<context-param>
    <param-name>javax.faces.SERIALIZE_SERVER_STATE</param-name>
    <param-value>true</param-value>
</context-param>

Also, try to change JSF version 2.2 still issue is persists

Environment :

  1. JSF 2.3
  2. Java 8
  3. Primefaces 6.1
  4. Tomcat 8.5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant