What is the solution?
Occasionally you can bypass the Unable to create new native thread issue by increasing the limits at the OS level. For example, if you have limited the number of processes that the JVM can spawn in user space you should check out and possibly increase the limit:
[root@dev ~]# ulimit -a core file size (blocks, -c) 0 --- cut for brevity --- max user processes (-u) 1800
More often than not, the limits on new native threads hit by the OutOfMemoryError indicate a programming error. When your application spawns thousands of threads then chances are that something has gone terribly wrong – there are not many applications out there which would benefit from such a vast amount of threads.
One way to solve the problem is to start taking thread dumps to understand the situation. You usually end up spending days doing this. Our suggestion is to connect Plumbr to your application to find out what is causing the problem and how to cure it in just minutes.