Understanding Xss- java stack internals
Cross posting from
http://forum.java.sun.com/thread.jspa?threadID=756193
I am using jdk 1.4.2.07 and run into the following error with the VM crashing with a defunct process:"Fatal: Stack size too small. Use 'java -Xss' to increase default stack size." on Linux. Does this imply a JVM bug given that this happens only when the VM attempts to launce a large number of threads (Tomcat).
It looks like in the absence of the Xss VM parameter, the JVM picks up the stack size based on the Linux process limits. In my case it was set to 2048k. Why would the VM crash when starting more than a threshold number of threads? My assumption is that the VM allocates the stack size to every thread. As the number of threads launched by the VM were to increase, there would be a state in which the VM would not be able to acquire more memory from the system. I have tried the latest version of the JDK 1.4.2 but it did not help either.
Any suggestions?
Thanks
[986 byte] By [
rhea] at [2007-10-3 1:41:08]

> I am using jdk 1.4.2.07 and run into the following
> error with the VM crashing with a defunct
> process:"Fatal: Stack size too small. Use 'java -Xss'
> to increase default stack size." on Linux. Does this
> imply a JVM bug given that this happens only when the
> VM attempts to launce a large number of threads
> (Tomcat).
No this is not the bug but the limitation , the default is 8k ....
> It looks like in the absence of the Xss VM
> parameter, the JVM picks up the stack size based on
> the Linux process limits. In my case it was set to
> 2048k. Why would the VM crash when starting more
> than a threshold number of threads? My assumption is
> that the VM allocates the stack size to every thread.
> As the number of threads launched by the VM were to
> increase, there would be a state in which the VM
> would not be able to acquire more memory from the
> system. I have tried the latest version of the JDK
> 1.4.2 but it did not help either.
Actually there will be the limit of threads that the process can span , if you cross tha limit the OS will throw the error which eventaully will be thrown by the JVM ....
Read this
http://forum.java.sun.com/thread.jspa?forumID=37&threadID=202978
Thread limit for a process can be changed , you got to change the configuration files , I dont remember the precise files and enteries ....
>>No this is not the bug but the limitation , the default is 8k ....
What is the default 8K? I was under the impression the stack size defaulted to the max as limited by ulimit unless specified via Xss JVM option. When i check using pmap, the stack shows up as 32K whatever be the Xss value.
>>Actually there will be the limit of threads that the process can span , if >>you cross tha limit the OS will throw the error which eventaully will be >>thrown by the JVM ....
>>Thread limit for a process can be changed , you got to change the >>configuration files , I dont remember the precise files and enteries ....
I think in my case the number of threads being spawned is being limited by the heap size allocated to the VM. In a test program i noticed that as i reduced the heap allocated to the JVM, the number of threads that the JVM could spawn increased. I checked the process limits and they seemed to be higher than what would be expected.
Thanls
rhea at 2007-7-14 18:39:12 >
