OutOfMemoryException: unable to create new native thread
March 20th, 2009
Applies to:
JBoss
Description:
Occurs while using Jboss
Cause:
This exception is caused by one of two things.
a. A common issue is that you reached the max number of user processes for the account that you’re running JBoss on. You can see the limit by using “ulimit -u”.
b. Another common issue is that the default stack size on recent vms with the -server option is probably too large.
a. Raising the limit should resolve this problem.
b. While the -server option should be specified with JBoss, it is probably wise to reduce the stack size (allocated per thread) for most applications. (On Solaris 32bit the default is 512k, 64bit is 1024k! The default for 32 bit linux is also 512k in recent VMs) Most JBoss applications are fine with a stack size of 128k. The size is controlled with the -Xss option on most VMs, however on solaris this can only increase the size. you must pass -XX:ThreadStackSize=128 to reduce it.