Last active
October 19, 2015 12:45
-
-
Save ykubota/aa9f23aa0445d4e1909b to your computer and use it in GitHub Desktop.
ThreadRecorder + DeadLock 検知を試してみる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dnf install -y --enablerepo="*debug*" hg net-snmp net-snmp-devel gcc gcc-c++ binutils binutils-devel maven ant java-1.8.0-openjdk java-1.8.0-openjdk-devel java-1.8.0-openjdk-debuginfo | |
hg clone http://icedtea.classpath.org/hg/heapstats | |
cd heapstats/ | |
./configure; make agent | |
sed -e "s/thread_record_enable=false/thread_record_enable=true/" agent/heapstats.conf > agent/heapstats_threadrecorder.conf | |
cd agent/test/deadlock | |
javac DLSample.java | |
java -agentpath:../../src/libheapstats.so=../../heapstats_threadrecorder.conf DLSample 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% java -agentpath:../../src/libheapstats.so=../../heapstats_threadrecorder.conf DLSample 5 | |
heapstats INFO: heapstats_agent 1.1.1 | |
heapstats INFO: Supported processor features: AVX | |
heapstats WARN: Could not find sun.misc.IoTrace class. | |
heapstats WARN: Turn off I/O recording. | |
heapstats INFO: Agent Attach Enable = true | |
heapstats INFO: SnapShot FileName = heapstats_snapshot.dat | |
heapstats INFO: Heap Log FileName = heapstats_log.csv | |
heapstats INFO: Archive FileName = heapstats_analyze.zip | |
heapstats INFO: Console Log FileName = None (output to console) | |
heapstats INFO: LogLevel = INFO | |
heapstats INFO: ReduceSnapShot = true | |
heapstats INFO: CollectRefTree = true | |
heapstats INFO: Trigger on FullGC = true | |
heapstats INFO: Trigger on DumpRequest = true | |
heapstats INFO: Deadlock check = true | |
heapstats INFO: Log trigger on Error = true | |
heapstats INFO: Log trigger on Signal = true | |
heapstats INFO: Log trigger on Deadlock = true | |
heapstats INFO: RankingOrder = delta | |
heapstats INFO: RankLevel = 5 | |
heapstats INFO: AlertPercentage = 50 ( 458752000 bytes ) | |
heapstats INFO: Java heap usage alert percentage = 95 ( 831 MB ) | |
heapstats INFO: Metaspace usage alert threshold 0 MB | |
heapstats INFO: SnapShot interval = 0 sec | |
heapstats INFO: Log interval = 300 sec | |
heapstats INFO: First collect log = true | |
heapstats INFO: Signal for normal logging is DISABLED. | |
heapstats INFO: Signal for all logging = SIGUSR2 | |
heapstats INFO: Signal for config reloading = SIGHUP | |
heapstats INFO: Thread recorder = true | |
heapstats INFO: Buffer size of thread recorder = 100 MB | |
heapstats INFO: Thread record file name = heapstats-thread-records.htr | |
heapstats INFO: Thread record I/O tracer = /usr/local/etc/iotracer/IoTrace.class | |
heapstats INFO: Send SNMP Trap = true | |
heapstats INFO: SNMP target = localhost | |
heapstats INFO: SNMP community = public | |
heapstats INFO: Temporary log directory = ./tmp | |
heapstats INFO: Archive command = "/usr/bin/zip %archivefile% -jr %logdir%" | |
heapstats INFO: Kill on Error = false | |
heapstats CRIT: ALERT(DEADLOCK): occurred deadlock. threadCount: 5, threadName: "Thread-2" | |
heapstats WARN: thread name: Thread-3, prio: 5 | |
heapstats WARN: thread name: Thread-4, prio: 5 | |
heapstats WARN: thread name: Thread-0, prio: 5 | |
heapstats WARN: thread name: Thread-1, prio: 5 | |
heapstats WARN: thread name: Thread-2, prio: 5 | |
heapstats WARN: Couldn't open copy source file. cause: 許可がありません | |
heapstats WARN: Could not copy /var/log/messages cause: 許可がありません | |
heapstats WARN: Could not copy file: /proc/self/fd/1 cause: 無効な引数です | |
heapstats WARN: Could not copy file: /proc/self/fd/2 cause: 無効な引数です | |
adding: journalctl_-q_--all_--this-boot_--no-pager_-o_verbose.log (deflated 92%) | |
adding: envInfo.txt (deflated 68%) | |
adding: udp6 (deflated 63%) | |
adding: tcp6 (deflated 68%) | |
adding: sockowner (stored 0%) | |
adding: redhat-release (stored 0%) | |
adding: threaddump.txt (deflated 83%) | |
adding: status (deflated 63%) | |
adding: smaps (deflated 96%) | |
adding: tcp (deflated 59%) | |
adding: udp (deflated 61%) | |
adding: cmdline (deflated 12%) | |
adding: limits (deflated 78%) | |
heapstats INFO: Collecting log has been completed: /home/ykubota/tmp/heapstats/heapstats/agent/test/deadlock/heapstats_analyze151017213801.zip | |
heapstats INFO: Elapsed Time (in Take LogInfo): 0.110000 sec (user = 0.000000, sys = 0.010000) |
ThreadRecorder の情報は heapstats-thread-records.htr .
ちょっと古いが下の HeapStatsFXAnalyzer の Thread Recorder パネルから読み込んで確認することができる。
https://github.com/ykubota/HeapStatsFXAnalyzer/releases/download/test/heapstats-analyzer-2.0-bin.zip
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
heapstats CRIT: ALERT(DEADLOCK): occurred deadlock. threadCount: 5, threadName: "Thread-2"
の部分でデッドロック検知して詳細ログを取っている。root 権限じゃないので一部情報が取れてない(/var/log/messagesとか)