Server Thread Dump
It is recommended that you take a thread dump of the TeamCity server from the Web UI (if the hanging is local and you can still open the TeamCity Administration pages): go to the Administration | Server Administration | Diagnostics page and click the View server thread dump link to open the thread dump in a new browser window or Save Thread Dump button to save it to the <TeamCity home>/logs directory (where you can later download the files from "Server Logs").
If the web UI is not responsive, try the direct URL using the actual URL of your TeamCity server.
If the UI is not accessible, you can take a server thread dump manually:
Under Windows
You have several options:
- To take a server thread dump if the server is run from the console, press Ctrl+Break in the console window (this will not work for an agent, since its console belongs to the launcher process).
- Alternatively, run jstack <pid_of_java_process> in the bin directory of the JVM used to by the application.
- If your server is running as a service, use the TeamCity-bundled thread dump tool (can be found in the agent's plugins). Run the command:
<TeamCity agent>\plugins\stacktracesPlugin\bin\x86\JetBrains.TeamCity.Injector.exe <pid_of_java_process>
Note that if the hanging process is run as a service, the server must be run from a console with elevated permissions (using Run as Administrator). If the service is run under System account, you might also need to launch the thread dumping tools via "PsExec.exe -s <path to the tool>\<tool> <options>"
Under Linux
- run jstack <pid_of_java_process> (using jstack from the same JVM as used by the application) or kill -3 <pid_of_java_process>. In the latter case output will appear in <TeamCity server home>/logs/catalina.out or <TeamCity agent home>/logs/error.log.
You can also add the teamcity.diagnostics.requestTime.threshold.ms=30000 internal property to automatically create a thread dump in the threadDumps-<date> directory under TeamCity logs whenever there is a user-originated web request taking longer than 30 seconds.
Please sign in to leave a comment.