Thread Dumps
There are a couple options for obtaining a thread dump.
- Send a `kill -3` to the process id of tc Server. Ex: `kill -3 1234`, where 1234 is the process id of tc Server. This will output the thread dump to `logs/catalina.out`. This only works on Linux/Unix system.
- Use the `jcmd` or `jstack` tools. Ex: `jstack 1234` or `jcmd 1234 Thread.print`.
- Use jvisualvm. This is a GUI tool, which can take thread dumps. Locate the local process running in jvisualvm, right click on it and select Thread Dump.
Heap Dumps
There are a number of ways to obtain heap dumps as well.
- You can turn on `-XX:+HeapDumpOnOutOfMemoryError`. This will make the JVM log a heap dump when there is an OutOfMemoryError. You would turn this on by editing `bin/setenv.sh` and adding `JAVA_OPTS='-XX:+HeapDumpOnOutOfMemoryError`. You might also want to add `-XX:HeapDumpPath` to indicate where the heap dump should be written.
- You can use `jmap`. Ex: `jmap -dump:file=heapdump.hprof,format=b <pid>`. This requires the process id of the tc Server instance.
- You can use `jcmd`. This is exactly the same as `jmap`. Ex: `jcmd GC.heap_dump filename=heapdump.hprof`.
- You can use jvisualvm. This is a GUI tool, which can take thread dumps. Locate the local process running in jvisualvm, right click on it and select Thread Dump.
- You can use Eclipse Memory Analyzer. This is an open source tool for taking and analyzing heap dumps.