This details the solution for the following two types exception on a Linux system:
java.lang.OutOfMemoryError: unable to create new native thread This exception is caused by one of two things. 1. The most common 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". Raising the limit should resolve this problem. Please note that there seems to be a hard coded ceiling of 1024 user processes, this may be a 2.4 kernel issues or a libc issue (both have such values in them, but I haven't done enough testing yet to tell which is causing this). 2. Once you get number one solved you may see this error again, this time it does actually appear to be a memory issue. By default kernel 2.4 creates threads with a stack size of 2MB. There also seems to be some limit that only allows the use of 1GB of memory for stack allocations. So lots of threads could eat up lots of the 1GB the system has to work with. The fix for this one is use the -Xss jvm flag. The value of 1024k (so -Xss1024k) seems to work well. On the 2.4 kernel this allows some 300 threads to be created per vm. Kernel 2.6 + NPTL Note: As many people may know Kernel 2.6 allows for a new threading model known as NPTL. This new model really helps with the above problem. First it allows more then 1024 user processes. I was able to create about 2400 threads with a stack size of 128k. This compared to the approximate 500 I could create with a similar setup under the 2.4 kernel. Plus NPTL was MUCH faster (a couple orders of magnitude). StackOverflowException or Attempt to ungaurd stack red zone failed These errors are seen when you run out of stack space. Best fix for this one is to use the -Xss jvm flag and lower the amount of stack size each thread gets. Again, 1024k (-Xss1024k) seems to be a good number. <a href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3823999#3823999">View the original post</a> <a href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3823999>Reply to the post</a> ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
