Re: RE : Tomcat7 OutOFMemoryError
Pid wrote: On 06/03/2012 07:12, Rainer Frey wrote: On 05.03.2012, at 14:14, Philippe ROUXEL wrote: When I set JAVA_OPTS= -Xmx1024m -Xss75m That means: each thread get a stack of 75MB. One of the following applies: * the operating system has a limit on thread stack size * the per process memory limit is reached before all initial tomcat threads are started * the system runs out of total memory before all initial tomcat threads are started 75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps you meant to set -Xms (which sets the initial Java heap size)? 75MB of stack is needed by hibenate to save the data aka a graph. I haven't used hibernate personally, but I never heard anything like that. So please elaborate. Where did you get that information? Also what do you mean with graph? The graph of associated objects that are updated by one hibernate call, or is your data actually graph data? If so, how is that mapped? do you have any self-referential associations? Is it really stack that you are talking about? I'm also interested in the answers to these questions. Ok, to get back to the OP's original question/assumption : Assuming that -Xss75M tells the JVM to allocate 75 MB of memory for the stack of each new thread created by the JVM, and noting that for a typical Tomcat instance, a minimum of about 10 threads seem to be created (with an additional one for each request being processed), this setting of -Xss75M would mean that a minimum of 750 MB is being allocated for the threads' stack. Assuming on the other hand that this is a 32-bit system and JVM (the OP didn't really say, but was mentioning Windows XP), where the maximum addressable memory for a process is 4 GB (of which 1 GB more or less are used by the OS itself); and considering the setting of -Xmx1024M for the Heap; and considering that the rest of the JVM and Tomcat may use some 1024 MB by themselves (for other things than the Heap and thread stacks); Considering all this thus, it is not really so surprising that the OP would get an OOM error at some point. Noting on the other hand that the JVM stack should be mainly used to push and pop subroutine/function parameters as they are being called, and that a reasonable stack size seems to be around 512KB at most, this explains several comments here which seem to put in doubt the wisdom of allocation 75 MB for the stack of each Java thread. I am far from a specialist, but considering that Hibernate seems to be some kind of generic tool, it is a bit unlikely that using it would require to set the stack size to an amount that is at least 150 times the JVM default, no ? All this seems to point - as usual - to some application problem, with as Chris pointed out some runaway recursive function call or similar. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RE : Tomcat7 OutOFMemoryError
On 6 Mar 2012, at 08:16, André Warnier a...@ice-sa.com wrote: Pid wrote: On 06/03/2012 07:12, Rainer Frey wrote: On 05.03.2012, at 14:14, Philippe ROUXEL wrote: When I set JAVA_OPTS= -Xmx1024m -Xss75m That means: each thread get a stack of 75MB. One of the following applies: * the operating system has a limit on thread stack size * the per process memory limit is reached before all initial tomcat threads are started * the system runs out of total memory before all initial tomcat threads are started 75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps you meant to set -Xms (which sets the initial Java heap size)? 75MB of stack is needed by hibenate to save the data aka a graph. I haven't used hibernate personally, but I never heard anything like that. So please elaborate. Where did you get that information? Also what do you mean with graph? The graph of associated objects that are updated by one hibernate call, or is your data actually graph data? If so, how is that mapped? do you have any self-referential associations? Is it really stack that you are talking about? I'm also interested in the answers to these questions. Ok, to get back to the OP's original question/assumption : Assuming that -Xss75M tells the JVM to allocate 75 MB of memory for the stack of each new thread created by the JVM, and noting that for a typical Tomcat instance, a minimum of about 10 threads seem to be created (with an additional one for each request being processed), this setting of -Xss75M would mean that a minimum of 750 MB is being allocated for the threads' stack. Assuming on the other hand that this is a 32-bit system and JVM (the OP didn't really say, but was mentioning Windows XP), where the maximum addressable memory for a process is 4 GB (of which 1 GB more or less are used by the OS itself); and considering the setting of -Xmx1024M for the Heap; and considering that the rest of the JVM and Tomcat may use some 1024 MB by themselves (for other things than the Heap and thread stacks); Considering all this thus, it is not really so surprising that the OP would get an OOM error at some point. Noting on the other hand that the JVM stack should be mainly used to push and pop subroutine/function parameters as they are being called, and that a reasonable stack size seems to be around 512KB at most, this explains several comments here which seem to put in doubt the wisdom of allocation 75 MB for the stack of each Java thread. 75Mb is far too much for the thread stack size in a normal application. I am not certain that it is necessarily fully allocated, just to confuse matters further. I vaguely remember another discussion about this, but can't find it in the archives. p I am far from a specialist, but considering that Hibernate seems to be some kind of generic tool, it is a bit unlikely that using it would require to set the stack size to an amount that is at least 150 times the JVM default, no ? All this seems to point - as usual - to some application problem, with as Chris pointed out some runaway recursive function call or similar. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RE : Tomcat7 OutOFMemoryError
On 06.03.2012 18:21, Pid * wrote: On 6 Mar 2012, at 08:16, André Warniera...@ice-sa.com wrote: Pid wrote: On 06/03/2012 07:12, Rainer Frey wrote: On 05.03.2012, at 14:14, Philippe ROUXEL wrote: When I set JAVA_OPTS= -Xmx1024m -Xss75m That means: each thread get a stack of 75MB. One of the following applies: * the operating system has a limit on thread stack size * the per process memory limit is reached before all initial tomcat threads are started * the system runs out of total memory before all initial tomcat threads are started 75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps you meant to set -Xms (which sets the initial Java heap size)? 75MB of stack is needed by hibenate to save the data aka a graph. I haven't used hibernate personally, but I never heard anything like that. So please elaborate. Where did you get that information? Also what do you mean with graph? The graph of associated objects that are updated by one hibernate call, or is your data actually graph data? If so, how is that mapped? do you have any self-referential associations? Is it really stack that you are talking about? I'm also interested in the answers to these questions. Ok, to get back to the OP's original question/assumption : Assuming that -Xss75M tells the JVM to allocate 75 MB of memory for the stack of each new thread created by the JVM, and noting that for a typical Tomcat instance, a minimum of about 10 threads seem to be created (with an additional one for each request being processed), this setting of -Xss75M would mean that a minimum of 750 MB is being allocated for the threads' stack. Assuming on the other hand that this is a 32-bit system and JVM (the OP didn't really say, but was mentioning Windows XP), where the maximum addressable memory for a process is 4 GB (of which 1 GB more or less are used by the OS itself); and considering the setting of -Xmx1024M for the Heap; and considering that the rest of the JVM and Tomcat may use some 1024 MB by themselves (for other things than the Heap and thread stacks); Considering all this thus, it is not really so surprising that the OP would get an OOM error at some point. Noting on the other hand that the JVM stack should be mainly used to push and pop subroutine/function parameters as they are being called, and that a reasonable stack size seems to be around 512KB at most, this explains several comments here which seem to put in doubt the wisdom of allocation 75 MB for the stack of each Java thread. 75Mb is far too much for the thread stack size in a normal application. I am not certain that it is necessarily fully allocated, just to confuse matters further. I vaguely remember another discussion about this, but can't find it in the archives. By the way some slightly related anecdote: I once had to diagnose a strange situation which at the end was explained by a user setting ThreadStackSize to 2M. Note that the docs say ThreadStackSize is in K (Kilo Bytes) and the code in fact does multiply the given value with 1000 (or 1024). So if you set ThreadStackSize to 2M verbatim you end up configuring a stack size of 2GB :) I forgot whether Xss also is in K or is in Bytes. Interpreting ThreadStack Size in K and multiplying up all other units given in the value IMHO is one of the most strange decisions done when designing JVM flags. Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat7 OutOFMemoryError
When I set JAVA_OPTS= -Xmx1024m -Xss75m I got: GRAVE: A child container failed during start java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: unable to c reate new native thread at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222) at java.util.concurrent.FutureTask.get(FutureTask.java:83) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja va:1128) I using windowsXP and tomcat7.0.26. Regards, Philippe - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat7 OutOFMemoryError
On 05.03.2012, at 11:30, Philippe ROUXEL wrote: When I set JAVA_OPTS= -Xmx1024m -Xss75m That means: each thread get a stack of 75MB. One of the following applies: * the operating system has a limit on thread stack size * the per process memory limit is reached before all initial tomcat threads are started * the system runs out of total memory before all initial tomcat threads are started 75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps you meant to set -Xms (which sets the initial Java heap size)? Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE : Tomcat7 OutOFMemoryError
75MB of stack is needed by hibenate to save the data aka a graph. Philippe De: Rainer Frey [mailto:rainer.f...@inxmail.de] Date: lun. 05/03/2012 13:19 À: Tomcat Users List Objet : Re: Tomcat7 OutOFMemoryError On 05.03.2012, at 11:30, Philippe ROUXEL wrote: When I set JAVA_OPTS= -Xmx1024m -Xss75m That means: each thread get a stack of 75MB. One of the following applies: * the operating system has a limit on thread stack size * the per process memory limit is reached before all initial tomcat threads are started * the system runs out of total memory before all initial tomcat threads are started 75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps you meant to set -Xms (which sets the initial Java heap size)? Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RE : Tomcat7 OutOFMemoryError
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Philippe, On 3/5/12 8:14 AM, Philippe ROUXEL wrote: 75MB of stack is needed by hibenate to save the data aka a graph. What!? Does Hibernate have some kind of method that needs to call itself recursively 100,000 times? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9U+QoACgkQ9CaO5/Lv0PBohQCgkNWLGYeCYUpza6SCeHWB0MfU r/YAniIl3sAUg/59qNoh8CJmkJKDhCn/ =2gvb -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RE : Tomcat7 OutOFMemoryError
On Mar 5, 2012 11:34 AM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Philippe, On 3/5/12 8:14 AM, Philippe ROUXEL wrote: 75MB of stack is needed by hibenate to save the data aka a graph. Philippe, are you confusing stack memory with heap memory? What!? Does Hibernate have some kind of method that needs to call itself recursively 100,000 times? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9U+QoACgkQ9CaO5/Lv0PBohQCgkNWLGYeCYUpza6SCeHWB0MfU r/YAniIl3sAUg/59qNoh8CJmkJKDhCn/ =2gvb -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RE : Tomcat7 OutOFMemoryError
Brooke Hedrick wrote: On Mar 5, 2012 11:34 AM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Philippe, On 3/5/12 8:14 AM, Philippe ROUXEL wrote: 75MB of stack is needed by hibenate to save the data aka a graph. Philippe, are you confusing stack memory with heap memory? What!? Does Hibernate have some kind of method that needs to call itself recursively 100,000 times? I found this page which may be of interest : http://www.odi.ch/weblog/posting.php?posting=411 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: RE : Tomcat7 OutOFMemoryError
From: André Warnier [mailto:a...@ice-sa.com] Subject: Re: RE : Tomcat7 OutOFMemoryError I found this page which may be of interest : http://www.odi.ch/weblog/posting.php?posting=411 This one's also pretty interesting, especially the link to Cliff Click's blog: http://mail.openjdk.java.net/pipermail/hotspot-dev/2011-June/004272.html (CC's blog doesn't have much to do with the OP's problem, but it illustrates the complexity of stack handling in the JVM and why one size fits none.) - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RE : Tomcat7 OutOFMemoryError
On 05/03/2012 20:39, Caldarale, Charles R wrote: From: André Warnier [mailto:a...@ice-sa.com] Subject: Re: RE : Tomcat7 OutOFMemoryError I found this page which may be of interest : http://www.odi.ch/weblog/posting.php?posting=411 This one's also pretty interesting, especially the link to Cliff Click's blog: http://mail.openjdk.java.net/pipermail/hotspot-dev/2011-June/004272.html (CC's blog doesn't have much to do with the OP's problem, but it illustrates the complexity of stack handling in the JVM and why one size fits none.) Varies by OS too. -XX:ThreadStackSize=512 Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.] From: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html p - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: RE : Tomcat7 OutOFMemoryError
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pid, On 3/5/12 3:54 PM, Pid wrote: Varies by OS too. -XX:ThreadStackSize=512 Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.] How can the default default be 0?! - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9VObIACgkQ9CaO5/Lv0PARCwCeK4OExMI0Xm3ZLfM/ji/gbHkm A4MAn1VgN5loW2QyiayGdDW6rb4WZBlb =QiA5 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: RE : Tomcat7 OutOFMemoryError
From: Christopher Schultz [mailto:ch...@christopherschultz.net] Subject: Re: RE : Tomcat7 OutOFMemoryError Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.] How can the default default be 0?! Very, very short-lived programs... The reference to zero means default stack size for the OS. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Re: RE : Tomcat7 OutOFMemoryError
On 05/03/2012 22:09, Christopher Schultz wrote: Pid, On 3/5/12 3:54 PM, Pid wrote: Varies by OS too. -XX:ThreadStackSize=512 Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.] How can the default default be 0?! I'm just quoting the docs! p -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: RE : Tomcat7 OutOFMemoryError
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chuck, On 3/5/12 5:20 PM, Caldarale, Charles R wrote: From: Christopher Schultz [mailto:ch...@christopherschultz.net] Subject: Re: RE : Tomcat7 OutOFMemoryError Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.] How can the default default be 0?! Very, very short-lived programs... The reference to zero means default stack size for the OS. Yes, at the command-line. It looked like Pid was quoting the documentation for what the default stack size was on a particular platform (used presumably when you set them to '0' or didn't specify them at all). If the default is 0, then ... ? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9VXJoACgkQ9CaO5/Lv0PCMPQCgpbnk/Iaoo7xunKiRAa7sByRW I9gAn0lrzRcnaRqSyUHo715aUocnt6j7 =2BUQ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RE : Tomcat7 OutOFMemoryError
On 05.03.2012, at 14:14, Philippe ROUXEL wrote: When I set JAVA_OPTS= -Xmx1024m -Xss75m That means: each thread get a stack of 75MB. One of the following applies: * the operating system has a limit on thread stack size * the per process memory limit is reached before all initial tomcat threads are started * the system runs out of total memory before all initial tomcat threads are started 75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps you meant to set -Xms (which sets the initial Java heap size)? 75MB of stack is needed by hibenate to save the data aka a graph. I haven't used hibernate personally, but I never heard anything like that. So please elaborate. Where did you get that information? Also what do you mean with graph? The graph of associated objects that are updated by one hibernate call, or is your data actually graph data? If so, how is that mapped? do you have any self-referential associations? Is it really stack that you are talking about? Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RE : Tomcat7 OutOFMemoryError
On 06/03/2012 07:12, Rainer Frey wrote: On 05.03.2012, at 14:14, Philippe ROUXEL wrote: When I set JAVA_OPTS= -Xmx1024m -Xss75m That means: each thread get a stack of 75MB. One of the following applies: * the operating system has a limit on thread stack size * the per process memory limit is reached before all initial tomcat threads are started * the system runs out of total memory before all initial tomcat threads are started 75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps you meant to set -Xms (which sets the initial Java heap size)? 75MB of stack is needed by hibenate to save the data aka a graph. I haven't used hibernate personally, but I never heard anything like that. So please elaborate. Where did you get that information? Also what do you mean with graph? The graph of associated objects that are updated by one hibernate call, or is your data actually graph data? If so, how is that mapped? do you have any self-referential associations? Is it really stack that you are talking about? I'm also interested in the answers to these questions. p -- [key:62590808] signature.asc Description: OpenPGP digital signature