Capturing Jstacks from Bitbucket Mesh Sidecar on Startup

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Data Center のみ - この記事は、Data Center プラットフォームのアトラシアン製品にのみ適用されます。

この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

目的

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:

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 count variable 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)

[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. 

最終更新日: 2024 年 1 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.