Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 54921 invoked from network); 2 Aug 2006 19:49:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2006 19:49:59 -0000 Received: (qmail 63631 invoked by uid 500); 2 Aug 2006 19:49:46 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 63609 invoked by uid 500); 2 Aug 2006 19:49:46 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 63598 invoked by uid 99); 2 Aug 2006 19:49:46 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2006 12:49:46 -0700 X-ASF-Spam-Status: No, hits=0.9 required=10.0 tests=DNS_FROM_RFC_WHOIS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [67.137.207.35] (HELO ambrosiasw.com) (67.137.207.35) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2006 12:49:43 -0700 Received: from localhost (localhost [127.0.0.1]) by ambrosiasw.com (Postfix) with ESMTP id 640D16AACACF for ; Wed, 2 Aug 2006 15:49:22 -0400 (EDT) Received: from ambrosiasw.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21097-08 for ; Wed, 2 Aug 2006 15:49:14 -0400 (EDT) Received: from [67.137.207.57] (unknown [67.137.207.57]) by ambrosiasw.com (Postfix) with ESMTP id 0BE8D6AAB047 for ; Wed, 2 Aug 2006 15:44:03 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <44CFCDB6.20203@christopherschultz.net> References: <25E9D9B0-E6A7-4278-8CBD-32FBF6BFF120@ambrosiasw.com> <44CFCDB6.20203@christopherschultz.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <4F9623DA-D770-4FB5-887E-0B81263B80DE@ambrosiasw.com> Content-Transfer-Encoding: 7bit From: Benjamin Adams Subject: Re: cpu 100% java Date: Wed, 2 Aug 2006 15:44:01 -0400 To: "Tomcat Users List" X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: by amavisd-new at ambrosiasw.com X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Aug 1, 2006, at 5:55 PM, Christopher Schultz wrote: > Ben, > >> I'm on OS X 10.4.7 running with weblog software (blojsom) >> I have to do a kill -9 on java to stop it from using 100+ on cpu >> sometimes, to let users connect. > > I assume that you also have to restart Tomcat at this point, yes? I just kill Java, Tomcat auto restarts it. > >> This comes up over and over in the log: >> 2006-08-01 17:22:08 StandardWrapperValve[blojsom]: Servlet.service >> () for >> servlet blojsom threw exception >> javax.servlet.ServletException: Servlet execution threw an exception > > [snip] > >> ----- Root Cause ----- >> java.lang.OutOfMemoryError: Java heap space > > You done run outta memory. Since this question ("why did I run out of > memory") comes up a lot, I'll save you some time going through the > gauntlet of one-off responses you are likely to get: > > 3. There might be a memory leak. Since you are getting 100% CPU use, > you might have found a problem with the software getting it into > a tight and infinite loop (or, at least sufficiently many > iterations > that it may as well be infinite) that generates loads of objects: > hence, your memory exhaustion. Make sure you have the latest > patches > from the vendor. > > How much ram do I set? Load Avg: 1.30, 1.28, 1.22 CPU usage: 51.3% user, 8.4% sys, 40.3% idle SharedLibs: num = 137, resident = 22.8M code, 3.20M data, 6.41M LinkEdit MemRegions: num = 7345, resident = 142M + 8.15M private, 27.4M shared PhysMem: 61.1M wired, 68.0M active, 173M inactive, 302M used, 209M free VM: 3.44G + 89.5M 18117(0) pageins, 0(0) pageouts PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE 825 java 102.4% 2:43:34 61 >>> 371 98.0M 872K 85.1M- 308M Should have 209MB Available. > > After that, it's just a matter of changing your memory settings. > How you > do that depends on your deployment, but generally you set the > environment variable JAVA_OPTS and use the "-X" parameters to set the > Java heap size. I added this to catalina.sh: JAVA_OPTS="$CF_JVM_OPTIONS -Xms128m -Xmx256m" > > Often, it helps to set the initial and maximum heap sizes to the same > thing, so that the memory manager never has to grow the heap during > the > life of the process -- that can save time and avoid OOMs if Java > demands > too much memory too fast (I really hope this is fixed in recent > versions > of the JVM... this used to happen and it really should not). > > Hope that helps, > > -chris > > Thanks --Ben --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org