Documentation for JIRA 5.2. Documentation for other versions of JIRA is available too.

操作の実行中に時折 JIRA がフリーズしたように見える場合があります。そのような場合、スレッド ダンプ — Java 仮想マシン内で現在実行中のスレッドおよびプロセスに関する情報を含むログ — の取り込みを行います。スレッド ダンプの取得は非破壊プロセスであるため、稼働中のシステム上で実施することができます。本書では、スレッド ダンプの取り込みに必要な手順を説明します。

The steps necessary to retrieve the thread dump are dependant on the operating system JIRA is running in — please follow the appropriate steps below.

On this page:

Windows Environment

startup.bat から JIRA を起動する

  1. JIRA 実行のコマンドコンソールウィンドウでタイトルバーを右クリックして、プロパティダイアログボックスを開き、「プロパティ」を選択します。
  2. [Layout] タブを選択します。
  3. Under Screen Buffer Size, set the Height to 3000.
  4. [OK] をクリックします。
  5. 開いているコマンド コンソール上で、CTRL-BREAK を押すと、コマンド コンソールにスレッド ダンプが出力されます。
  6. "Full thread dump" と書かれた行まで、コマンド コンソールをスクロールします。
  7. タイトルバーを右クリックし、編集 ->マークを選択します。スレッドダンプのテキスト全体をハイライト表示します。
  8. Right click the title bar and select Edit -> Copy. The thread dump can then be pasted into a text file.

JIRA running as a Windows Service

jstack を使用する場合

The JDK ships with a tool named jstack for generating thread dumps.

  1. Identify the process. Launch the task manager by, pressing Ctrl + Shift + Esc and find the Process ID of the Java (JIRA) process. You may need to add the PID column using View -> Select Columns ...
  2. ‪‪jstack <pid>‬ を実行して、 単一のスレッドダンプを取得します。このコマンドで、プロセス ID ‪ <pid>‬ の1個のスレッドダンプが取得出来ます。この場合のプロセス ID は22668です。
adam@track:~$ jstack \-l 22668 > threaddump.txt

このコマンドにより、現在のディレクトリに threaddump.txt というファイルが出力されます。

‪ jstack‬ のよくある問題

  • You must run jstack as the same user that is running JIRA
  • 実行が可能な jstack が $PATH にない場合、<JDK_HOME>/bin ディレクトリで探します。
  • java.lang.NoClassDefFoundError: sun/tools/jstack/JStack が発生したら、JDK の lib ディレクトリ tools.jar があるかどうかを確認します。tools.jar がない場合、JDK のフル バージョンをダウンロードします。

Linux / Unix / OS X 環境

Linux/Unix Command Line

  1. JIRA を実行している java プロセスを識別します。これは以下の様なコマンドで実現できます。

    ps -ef | grep java

    次のようなプロセスが見つかります。

    keithb     910   873  1 17:01 pts/3    00:00:18 /usr/java/jdk/bin/java -Xms128m -Xmx256m
    -Xms128m -Xmx256m -Djava.awt.headless=true -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    -Djava.awt.headless=true -Djava.endorsed.dirs=/tmp/atlassian-jira-enterprise-3.6-standalone/common/endorsed
    -classpath :
  2. スレッド ダンプを取得するには、次のコマンドを実行します。

    kill -3 <pid>

    ここで、pid がプロセス ID (この場合は 910) です。

  3. The thread dump is logged to the console in which JIRA was started.

Linux/Unix Alternative: Generating Thread Dumps using jstack

スレッド ダンプを取得する際 kill -3 <pid> で問題が発生した場合、java ユーティリティ である jstack を使用し、指定したプロセスの Java スレッドのスタックトレースを出力します。

  1. JIRA を実行している java プロセスを識別します。これは以下の様なコマンドで実現できます。

    ps -ef | grep java
  2. 次のようなプロセスが見つかります。

    adam 22668 0.3 14.9 1691788 903928 ? Sl Jan27 9:36 /usr/lib/jvm/java-6-sun-1.6.0.14/bin/java -Djava.util.logging.config.file=/home/adam/Products/installs/atlassian-jira-enterprise-4.0.1-standalone/conf/logging.properties -XX:MaxPermSize=256m -Xms128m -Xmx1048m -Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Datlassian.mail.senddisabled=false -Datlassian.mail.fetchdisabled=false -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/home/adam/Products/installs/atlassian-jira-enterprise-4.0.1-standalone/common/endorsed -classpath /home/adam/Products/installs/atlassian-jira-enterprise-4.0.1-standalone/bin/bootstrap.jar -Dcatalina.base=/home/adam/Products/installs/atlassian-jira-enterprise-4.0.1-standalone -Dcatalina.home=/home/adam/Products/installs/atlassian-jira-enterprise-4.0.1-standalone -Djava.io.tmpdir=/home/adam/Products/installs/atlassian-jira-enterprise-4.0.1-standalone/temp org.apache.catalina.startup.Bootstrap start
    
  3. Run jstack <pid> to Capture a Single Thread Dump
    This command will take one thread dump of the process id <pid>, in this case the pid is 22668, and log output to the file JIRAthreaddump.txt

    adam@jiratrack:~$ jstack 22668 > JIRAthreaddump.txt
    
  4. Take Multiple Thread Dumps
    Typically you'll want to take several dumps about 10 seconds apart, in which case you can generate several dumps and output the stack traces to a single file as follows:

    adam@jiratrack:~$ jstack 22668 >> JIRAthreaddump.txtdam@jiratrack:~$ jstack 22668 >> JIRAthreaddump.txtadam@jiratrack:~$ jstack 22668 >> JIRAthreaddump.txt
    

Analysis Tools

Try TDA or Samurai to inspect your thread dump.

TDA

  1. Download TDA
  2. CD to the directory where the JAR exists
  3. 次のコマンドを実行します。

    java -jar -Xmx512M ~/tda-bin-{1}.{2}/tda.jar
    
  4. Open your catalina.out file, containing the thread dump

スレッドダンプについて知りたい場合は、ナレッジベース記事をご参照ください: