Error 500 occurs when a user tries to add their SSH key
症状
Bitbucket Server shows Error 500 when a user tries to add a public SSH key to their profile.
診断
Check the atlassian-bitbucket.log
file for the following error:
ERROR [http-nio-10009-exec-7] @XWEJ1Cx112x323556x0 xxxx 127.0.0.1,0:0:0:0:0:0:0:1 "GET /mvc/error500 HTTP/1.1" c.a.s.i.web.ErrorPageController
There was an unhandled exception loading [/plugins/servlet/ssh/account/keys]
com.google.common.util.concurrent.UncheckedExecutionException: com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IndexOutOfBoundsException: Index: 0
[...]
Caused by: com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IndexOutOfBoundsException: Index: 0
[...]
Caused by: java.lang.IndexOutOfBoundsException: Index: 0
at java.util.Collections$EmptyList.get(Collections.java:4454)
at com.google.common.collect.Iterables.get(Iterables.java:728)
at com.atlassian.bitbucket.internal.ssh.server.DefaultHostKeyPairProvider$1.lambda$$0(DefaultHostKeyPairProvider.java:54)
at com.atlassian.util.concurrent.Lazy$Strong.create(Lazy.java:85)
at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:325)
at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143)
原因
The server you are running Bitbucket Server on cannot load additional SSL modules as it is most probably running out of memory.
However, as it still runs within the pre-allocated heap space the application itself is stable and doesn't produce any visible signs of insufficient memory.
There might be two possible causes:
- You've allocated too much heap space (using
-Xms
and-Xmx
parameters) to your Bitbucket Server and there is no more memory available for other processes to run on the server. - Your system is under heavy load and other processes use all the memory and a yellow banner stating "Bitbucket Server is reaching resource limits" appears in your application.
ソリューション
Ad 1. The default heap space allocation for Bitbucket Server is between 512 and 1024 MB and it works well for customers with large instances in our experience as Bitbucket Server's heap size has zero impact on hosting operations. Most of the memory usage in a server running Bitbucket Server is on the forked git
processes. So allocating more memory to the Bitbucket Server JVM won't help your instance scale and perform better. Please make sure your Bitbucket Server application doesn't use most of the server memory by keeping the -Xms
and -Xmx
parameters at reasonably low level.
Ad 2. Please follow the steps you can find in Bitbucket Server is reaching resource limits article to troubleshoot the memory issues.