Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 95FD4979C for ; Tue, 31 Jan 2012 10:57:13 +0000 (UTC) Received: (qmail 98355 invoked by uid 500); 31 Jan 2012 10:57:09 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 98241 invoked by uid 500); 31 Jan 2012 10:57:07 -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 98232 invoked by uid 99); 31 Jan 2012 10:57:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2012 10:57:07 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of 777user@gmail.com designates 209.85.210.45 as permitted sender) Received: from [209.85.210.45] (HELO mail-pz0-f45.google.com) (209.85.210.45) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2012 10:57:01 +0000 Received: by dadp14 with SMTP id p14so169946dad.18 for ; Tue, 31 Jan 2012 02:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=901istxN4CXvBPQZi1xt3P5dZOcq6+lGTNIcheZoeqI=; b=dH4Om4M9hyoP0uTXzDIflQWnyKmVS/rlGNBR61mu056lbcMkknaXMXfq3S6mHcinBn B2vD4kYT69NFHif9LtnaROY+hEHkbM+2qhQdBjC12HLav9jhnK2EMmIrE1sffnM+DiX/ c8ByAnYJWFi/+oit29ELwWqx0lmhG0Qf5s5qw= MIME-Version: 1.0 Received: by 10.68.75.11 with SMTP id y11mr49444001pbv.51.1328007401667; Tue, 31 Jan 2012 02:56:41 -0800 (PST) Received: by 10.142.234.18 with HTTP; Tue, 31 Jan 2012 02:56:41 -0800 (PST) In-Reply-To: <4F270B14.5050002@ice-sa.com> References: <4F22EDB9.9020404@pidster.com> <4F230BE8.1010501@pidster.com> <7215BA462D00D343B2837F9113F0131F010574F905@POSTOFFICE02.polydyne.com> <7215BA462D00D343B2837F9113F0131F010574F953@POSTOFFICE02.polydyne.com> <99C8B2929B39C24493377AC7A121E21FB010D92A01@USEA-EXCH8.na.uis.unisys.com> <4F26C41A.8080304@verizon.net> <4F26DB4B.9030407@pidster.com> <4F270B14.5050002@ice-sa.com> Date: Tue, 31 Jan 2012 08:56:41 -0200 Message-ID: Subject: Re: Java.lang.out.of.memory not clearly.... From: Luciano Andress Martini <777user@gmail.com> To: Tomcat Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2012/1/30, Andr=E9 Warnier : > Luciano Andress Martini wrote: > ... >> Now my boss talked with the developers and added a command to call the >> garbage colector, it is very better now, and we find the bad guy, its >> a button, when we click then, the memory increases. >> > Luciano, > > your original post about this issue mentioned this error : > ... > > at java.lang.Thread.run(Thread.java:662) Caused by: > > java.lang.OutOfMemoryError: Java heap space > > > > Java options (that i configurate) > > -Djava.awt.headless=3Dtrue > > -Xmx512m > > -XX:MaxPermSize=3D3512M > > -XX:+CMSIncrementalMode > > -XX:+UseConcMarkSweepGC > > -XX:+CMSClassUnloadingEnabled > > -XX:ParallelGCThreads=3D4 > > -XX:+UseParNewGC > ... > and later you told us (not necessarily in that order) : > > The system is 64 bits + Java 64 bits, running in debian > > paravirtualized with Xen. > > > ... > > (available system memory) : By default 4GB per virtual machine with > tomcat. > ... > Java using: 914mb > >> Free memory on the virtual machine server: 2152 > >> > > -- end of data -- > > > Maybe a good idea right now would be to calm down, not panic, get a cup o= f > coffee, sit > down, read what you have already been told, and think about it for a whil= e > before you > change any more parameters left and right. > And the same for your boss and the programmers. > > Because right until now, you and your boss and the programmers are giving > the impression > of a bunch of headless chicken running around in the control room of a > nuclear power > plant, pressing (*) on any button that is available, to try an stop the > alarm bell. > That is usually not the best way to avoid a melt-down. > > First, if I may ask, from where did you get the java parameters that you = are > showing above ? > > The only parameter which has a direct relationship with the issue that > caused the error > (repeat: java.lang.OutOfMemoryError: Java heap space) > is this one : > > > -Xmx512m > > which limits the Java Heap to 512 MB of memory, maximum. > And that does not seem to be enough, because you got an error > "java.lang.OutOfMemoryError: > Java heap space". > > All the other "-XX" parameters on your Java command-line are probably > unnecessary, and > they probably do more harm than good. > Java has default values for all of those, which work fine in 95% of cases= , > for thousands > on Tomcat servers all over the world. > And since neither you, nor the programmers, nor you boss seem to know muc= h > about java, you > should probably not play with these parameters, unless you understand > exactly what they do. > And as Chuck mentioned, your boss should stop playing with the Garbage > Collector. Java > will automatically run the Garbage Collector when it needs to run it, and > you should leave > java to decide when that is necessary. > > So why do you not set the java command-line this way : > > java -Djava.awt.headless=3Dtrue -Xms1024m -Xmx1024m > > and that's it. No more "-XX" parameters for now. > Java will set all the other parameters to their default values, which are > probably fine. > > And then try your application. And then /if there is a problem/ let us k= now > again what > the Tomcat logfile says, before you change any parameter again. > > The "-Xms1024m -Xmx1024m" switches will set both the minimum and the maxi= mum > java Heap > size to 1024 MB. In other words, they will "fix" to 1024 MB the size of = the > Heap, which > is where java allocates the space that it needs to store new objects, whe= n > it needs them. > And before this Heap fills up, java automatically runs the Garbage > Collector, to free some > space on the Heap. This is automatic and normal; that is how java works. > > /If/ there is a memory leak in the application, then little by little, an= d > despite the > fact that java runs the Garbage Collector from time to time, the Heap wil= l > fill up, and > the GC will not be able to make space free anymore. And then java will t= ry > to do a GC > more often, and your server will slow down. > And then, sooner or later, you will have an "out of memory" again. > > But maybe there is no memory leak. > So far, neither you nor us have seen any /evidence/ that there is a memor= y > leak. Maybe the > size of the Heap - which you had limited before to 512 MB - was just not > enough to process > the millions of transactions of which you were talking. > > When you click a button in the application, something happens in the > application > (supposedly, some work gets done). In java, when an application does > something, most of > the time it means that many new objects get created; and creating new > objects uses space > on the Heap. Most of the time also, the majority of these objects only h= ave > a short > lifetime, and when they are not needed anymore they disappear, and java w= ill > after a while > free the space that they used on the Heap. So the usage of memory inside > the Heap goes up > and down all the time, and that is normal. > > There are many methods and tools for java that allow to see what java doe= s > with the > memory. If you still have a problem after the above, we will tell you ab= out > them. > But the first step is to simplify your setup, run the application and > finding out if there > is really a problem. > > > (*) I would have used pecking, but since they're headless.. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > my heap size is 1512, some wrong in the message, but now 2000 with the Xms too. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org