Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 55147 invoked from network); 8 Mar 2011 12:31:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Mar 2011 12:31:23 -0000 Received: (qmail 54694 invoked by uid 500); 8 Mar 2011 12:31:20 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 54607 invoked by uid 500); 8 Mar 2011 12:31:20 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 54599 invoked by uid 99); 8 Mar 2011 12:31:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 12:31:20 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 12:31:13 +0000 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1Pww3w-0005yu-OZ for user@struts.apache.org; Tue, 08 Mar 2011 04:30:52 -0800 Message-ID: <31096630.post@talk.nabble.com> Date: Tue, 8 Mar 2011 04:30:52 -0800 (PST) From: jogep To: user@struts.apache.org Subject: Re: High CPU usage In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: jogep@apache.org References: X-Virus-Checked: Checked by ClamAV on apache.org If you don't use the javatemplate plugin all Struts2 UI Tags are using freemarker templates internal. So maybe you can solve your problem with latest Struts2 Version. Johannes Abhi-2 wrote: > > Hi > > I have a production web application running in Tomcat. The web application > uses struts 2 as MVC layer. > > We had an issue wherein one of the web servers spiked to 100% cpu usage. > This issue lasted for over several hours. I took the thread dump and saw > over several hundred threads in runnable state and the dumps show the > following stack trace for most of the threads. > > "TP-Processor480" daemon prio=10 tid=0x00002aab8c1ff400 nid=0xf23 runnable > [0x00000000656af000..0x00000000656b3d90] > > java.lang.Thread.State: RUNNABLE > > at java.util.HashMap.get(HashMap.java:303) > > at > com.opensymphony.xwork2.util.LocalizedTextUtil.buildMessageFormat(LocalizedTextUtil.java:620) > > at > com.opensymphony.xwork2.util.LocalizedTextUtil.getDefaultMessage(LocalizedTextUtil.java:588) > > at > com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:461) > > at > com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:224) > > at > com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:99) > > at org.apache.struts2.components.Text.end(Text.java:158) > > at > org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43) > > at > org.apache.jsp.tag.web.tabs_tag._jspx_meth_s_005ftext_005f2(tabs_tag.java:565) > > at > org.apache.jsp.tag.web.tabs_tag._jspx_meth_s_005fif_005f0(tabs_tag.java:280) > > at org.apache.jsp.tag.web.tabs_tag.doTag(tabs_tag.java:113) > > at org.apache.jsp.myjsp_jsp._jspService(myjsp_jsp.java:379) > > at > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) > > at > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331) > > at > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) > > at > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) > > at > org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679) > > at > org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461) > > at > org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399) > > at > org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) > > at > org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:139) > > at > org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178) > > at > com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348) > > at > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253) > > at > com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221) > > at > com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) > > at > com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) > > at > com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) > > at > com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) > > at > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) > > at > com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150) > > at > org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48) > > at > com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) > > at > com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) > > at > com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) > > at > com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) > > at > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) > > > Now the code in question uses struts s:text tag and just fetches the value > from a property file. I am not sure why so many threads should get stuck > over there (threads are in runnable state).java.util.HashMap is not > threadsafe, and if accessed concurrently by multiple threads, one > particular > mode of failure is an infinite loop within a particular > bucket, > which could be causing this issue. > > This issue happens only once after our deployment, and if we restart the > server it will never occur. > > https://issues.apache.org/jira/browse/ww-2808 mentions that using s:text > could have performance issues. They mentioned configuring freemarker cache > could improve the performance. > > We are using Struts 2.0.11 and don't use freemarker template. Will > updating > the Struts to latest version and switching to freemarker template could > help > us in resolving this issue? (as freemarker template can be configured to > use a internal ConcurrentHashMap). > > I never used freemarker template and we don't want to shift to this unless > we are sure that this could fix the issue. > > Did anyone experienced such issue before. > > > Thanks > > Abhilash > > -- View this message in context: http://old.nabble.com/High-CPU-usage-tp31095892p31096630.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org