java.lang.OutOfMemoryError: Unable to Create New Native Thread
Problem
The catalina.out
logs report that Stash is running out of memory:
27-Mar-2015 19:20:00.717 SEVERE [http-nio-57990-exec-5] org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:691)
Cause
Stash during normal operations will fork Git processes to complete many of it's functions. These Git processes use memory that is available to the system and does not use the memory allocated in the JVM. This error indicates that there was not enough memory for a Git process to start. More information about how much memory Stash requires can be found at Scaling Stash.
Workaround
Reduce the number of Git hosting operations allowed on the server by lowering the throttle.resource.scm-hosting
in stash-config.properties.
#Default - throttle.resource.scm-hosting=1.5*cpu
throttle.resource.scm-hosting=4
Resolution
Increase the available system memory for the Stash server.