I am trying to deploy WSO2 Message Broker and I get the following error in server startup and terminated. How to fix this ?
java.lang.OutOfMemoryError: unable to create new native thread
This is very interesting error. The exception tell us the Out Of Memory but what actually happens is by nature linux system allows limited number of treads for specific user. If you try to run more threads than this number this error will occurred. You can see the allowed number of threads using following command
ulimit -u
The fix is simple. Just run the below command before you try to invoke the program
ulimit -u 2000
(The number 2000 depends on your application and you can decide it)
This fix is temporary and for the permanent fix please see the following blog post click here