One challenge I have always ran into with ColdFusion or JRun is that when the server hung on windows there was no easy way to take a thread dump. While jrun.exe is running as a service there is no direct way to send a signal to the JVM to signal a thread dump. Most of the time you have to start it from a console window and let it run there. When you do that though you run the risk of someone closing you user session and having the server die. It is much safer to run it as a service. This takes us back to the problem at hand.....if the server hangs how do I obtain a thread dump? Mike Collins recently pointed me in the direction of a utility that you could use to obtain a thread dump even while running as a service.
The tool is called StackTrace and it is a swing based utility the provides hooks into a java process running as a service. In order to run it you may need to download the latest 1.4 JDK and run the install, it should ask you during the install if you want to install the JRE to Internet Explorer. Check the box and proceed with the install and it will start when you invoke it from the website.
When you open the StackTrace utility you can browse the running java processes and it should look something like this.
If you have multiple servers running it may be difficult to identify which processID is mapped to a particular JRun server there is another utility that I use called Process Explorer from SysInternals. Once you download Process Explorer and open it, select Options > Highlight Services to see what you're running. Right-clicking on a service and selecting Properties gives you all the information you need on the resources it is using. The following screenshot provides an example of the JRun CFusion server. The process ID is 348 and we could choose this process in the StackTrace utility to obtain a thread dump.
One limitation that you need to be aware of is that you cannot use this utility from Terminal Services. This is not a limitation of the product it is a limitation of windows since the utility cannot attach to process running in a terminal window. You must instead use PC Anywhere or VNC to run the utility or run it directly at the console of the server.
I have not used this utility extensively so I do not know how stable it is nor do I directly endorse it. It was something cool that was pointed out to me so proceed at your own risk.
Does it work with the Terminal Client running in Console mode?
Thats a good question on the servers I was testing the console would not allow remote control. I am willing to bet that it will work though. If anyone is successful in testing please post back.
Thanks Brandon (and thanks Mike)! I expect that this is something I will be recommending quite frequently (when I return :)
We use it via RDP with the /console switch and it works fine. Don't think it works if you don't supply /console.
I've recently been beta testing a tool specifically for CF which does this. Check it out:
PS: No i don't work for that company.
FusionReactor has now been released and there is a trial/free edition which you can check out.
If anyone wants to post any feedback then I'd love to hear it.
PS: Yes, I do work for that company! *smiles*
Check out this stack trace utility now. It no longer works anywhere that I have donwloaded it. I get 'No License Available.' errors and the guy that supports the app can not be reached. His site does not seem to be up either as I get Tomcat error messages when trying to access the site. (Click on the StackTrace link the original post)
not you can use mstsc.exe /console at the command line and it will start Remote Desktop client. then log into your server. Then you can use the tool from Remote Desktop.
The /console switch is only supported in Windows 2003 Server. You cannot RDP into the 'console' on a Windows 2000 Server, and therefore cannot use the StackTrace utility. We have to use KVMoIP to get around this on our Win 2k servers.
FYI - the link to the download above is broken, but you can get StackTrace from http://www.adaptj.com/main/download