• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Heap and thread dump on Windows service

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to take a heap dump and a thread dump of my Java app. Now I know how to do this if I run the Java app from a command line using java.exe. But my app is started as a Windows service using Apache's Proc Run. Thus, in one example, I have tomcat.exe running. I tried running VisualVM but it doesn't see tomcat.exe. I guess I have been so used to running things from the command line that I haven't looked into getting thread dumps or heap dumps in other environments. Anyone know what the best way to get such dumps would be?
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure it will work in your case, but I was able to do this for WebStart application which also doesn't display the text mode console: go to Java Control Panel and on the Advanced tab activate Java console/Show console. When the application starts, it should display a regular window (ie. not the text mode console) which will contain the JVM console output. There are several keys listed in the output when the console appears; pressing these keys initiates some actions, including Thread Dump. Not sure about Heap Dump, though.

This might not work if it really runs as a Windows service, with disabled desktop interaction.

On the other hand, I'd expect that tomcat will start the applications in separate processes, using java.exe (at least OAS does it this way). Don't you see any java.exe in VisualVM?
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, there is no java.exe in Task Manager. I have one process named tomcat6.exe*32, and another named container.exe*32 (yes, we are running 32-bit JVMs on a 64-bit system). I'll experiment with the Java Control Panel suggestion and see if that works (I can always enable desktop interaction on the service).
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the Java Control Panel settings. Interestingly enough, I get a console for tomcat6.exe, but not for container.exe. Looking at Process Explorer, tomcat6.exe is using the JRE JVM, while container.exe is using the JDK JVM, that could explain the difference (they are both the same Java version). But I noticed two other processes with the JRE loaded, but no console showed up for them.

I tried using jmap to get a thread dump but Windows displays the message "Not enough storage is available to process this command." and none of the workarounds for this error that I found while googling have yielded any results (apparently there are multiple "storage" areas and I haven't found a web page that tells me how to increase the one I need).
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried running VisualVM as a service ?
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jayesh, that looks interesting, I'll have to give it a try.

Meanwhile one of my colleagues volunteered to look into running the service in debug mode and then remotely connecting VisualVM and was successful.

Oh, and I found out why only one of my services displayed a console - it was the only service for which I enabled desktop interaction!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic