java.lang.OutOfMemoryError: Unable to Create New Native Thread
As of BitbucketServer 5.x+, no logs are written to the BITBUCKET_INSTALL directory. The contents of catalina.out will be written to BITBUCKET_HOME/log/atlassian-bitbucket.log file.
問題
The catalina.out
logs report that Bitbucket Server 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)
原因
# Issue 1:
Bitbucket Server 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 Bitbucket Server requires can be found at Scaling Bitbucket Server.
回避策
# Issue 1:
回避策:
This issue could be worked around by reduce the number of Git hosting operations allowed on the server by lowering the throttle.resource.scm-hosting
in bitbucket.properties.
#Default - throttle.resource.scm-hosting=1.5*cpu
throttle.resource.scm-hosting=4
ソリューション
# Issue 1:
You will probably need to budget the memory of your server properly
More information about how much memory Bitbucket Server requires can be found at Scaling Bitbucket Server.
# Issue 2:
You could be running your Stash on a JVM that is only 32-Bits - and that will limit you to 4GB. This could generate performance issues for you and you will need to update your system to a 64-Bit JVM and start up Stash with that JVM.