This link pretty well describes how this error is generated by the JVM: http://javaeesupportpatterns.blogspot.ro/2012/09/outofmemoryerror-unable-to-create-new.html
Basically it is very OS dependent. On RedHat Linux 6.5 (most likely other versions of the distribution / version and kernel) max_threads = max_process x 2.
The maximum number of threads depends on the number of allowed processes. What maximum number of processes depends on the maximum physical memory that you have installed.
If you look in the limits.conf file (on my RHL 6.5 in /etc/security/limits.d/90-nproc.conf). Run file:
# Default limit for number of user processes to prevent
You will see that for users without root, this is 1024 (which means 2048 maximum threads).
To see the maximum number of threads that your user can create, run this command "cat / proc / sys / kernel / threads-max" or "sysctl kernel.threads-max".
To solve a problem like this (at least it worked for me) as root, you will need ncrease of the maximum allowed threads:
echo 10000> / proc / sys / kernel / threads-max
This affects all users and the root. The user must log out and then log back in for the settings to affect.
bobbyus
source share