Max User Processes and Java OutOfMemoryError "unable to create new native thread": Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 37: Line 37:


<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
:[[Ulimit#EtcSecurityLimits.conf|<tt>ulimit /etc/security/limits.conf</tt>]]
:[[Ulimit#.2Fetc.2Fsecurity.2Flimits.conf|<tt>ulimit /etc/security/limits.conf</tt>]]
</blockquote>
</blockquote>



Revision as of 01:07, 11 June 2016

Internal

Overview

Java OutOfMemoryError "unable to create new native thread" is usually the result of the java process attempting to create more threads than the system "max user processes" limit.

To figure out the number of threads, monitor the JVM, or use MCS, or read that number from /proc TODO: how?.

Then, read the number of maximum user processes allowed for the UNIX user that runs that JVM. Look for "max user processes":

[jbossusr@tcffevt1r6ap02 ~]$ ulimit -an

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 127470
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 16384
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Then increase that number in /etc/security/limits.conf.

Also see:

ulimit /etc/security/limits.conf

To Take Home

On Linux, Java Threads == User Processes