Capturing Jstacks from Bitbucket Mesh Sidecar on Startup

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Bitbucket Mesh Sidecar may fail to start up or experience a delay in starting up which can cause the connection from Bitbucket to timeout. Because Sidecar handles the local SCM tasks for Bitbucket, this failure can result in startup failures with the Web UI displaying an error such as:

SpringMVC dispatch springMVC could not be started

If logging is not sufficient to diagnose the issue, Support may request for Jstacks. This may be difficult to capture during startup because the child process is spawned by Bitbucket. To assist with this, we can use a bash script such as the following:

1 2 3 4 5 6 7 8 9 10 count=1; while true; do MESH_PID=$(pgrep -f mesh-app.jar | head -n1) TS=$(date +%s) if [ -n "$MESH_PID" ]; then jstack -l $MESH_PID >> "bb-sidecar-jstack-$count-$TS.out" echo "Captured jstack $count at $TS" ((count++)) sleep 5s fi done
  • The countvariable is used to hold the iteration

  • We capture the PID for Sidecar using the pgrep command

  • We then use the TS variable to capture the timestamp for each Jstack

NOTE: This command should be run as the user running Bitbucket (i.e. atlbitbucket)

Solution

Example

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [atlbitbucket]$ count=1; while true; do MESH_PID=$(pgrep -f mesh-app.jar | head -n1) TS=$(date +%s) if [ -n "$MESH_PID" ]; then jstack -l $MESH_PID >> "bb-sidecar-jstack-$count-$TS.out" echo "Captured jstack $count at $TS" ((count++)) sleep 5s fi done Captured jstack 1 at 1706633261 Captured jstack 2 at 1706633267 Captured jstack 3 at 1706633272 Captured jstack 4 at 1706633277 Captured jstack 5 at 1706633282 Captured jstack 6 at 1706633288 Captured jstack 7 at 1706633293 Captured jstack 8 at 1706633298 Captured jstack 9 at 1706633303 Captured jstack 10 at 1706633309 ^C [atlbitbucket]$ tar cvzf bb-sidecar-jstacks.tar.gz bb-sidecar-jstack-*

CTRL+C can be used to exit the loop and the tar command can be used to collect and compress the Jstacks for upload to the Support case.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.