Max User Processes and Java OutOfMemoryError "unable to create new native thread"
Jump to navigation
Jump to search
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
or
ulimit -u
Then increase that number in /etc/security/limits.conf.
Also see:
To Take Home
On Linux, Java Threads == User Processes