• 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

.JAR file appears to stop running

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have built a .JAR file, when I run it, it stops running at certain points. I have a linux box with 2Gig of RAM. 'top' shows the free memory at 500K. Is there a way to get a stack dump or core dump of the JVM?

Kyle
 
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To take a heap dump:
Run "jmap -dump <pid>" to dump the heap then use one of the other tools provided by Oracle (jvisualvm) to examine the results, which will tell you what objects were in use at the time the heap was taken. If you configure your java command-line args right you can also attach jvisualvm and monitor memory/thread/cpu usage live, but I don't remember the args to do that off the top of my head.

I'm assuming both of these programs are available in Linux JDK.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly what does "stops running" mean?

1. No longer accepts inputs?
2. No longer creates output?
3. No exception or error report?
4. Zero CPU utilization?

Bill
 
Yile Ku
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THe jar file runs through a list of users and updates a database. The update includes some queries over the network. It just stops during one of the queries over the network. I go into 'top' and it is using alot of the CPU (like 99%) I am guessing it is trying to garbage collect and get more memory. I used jmap, I had to use the -F option to get a heap. I then went into jhat, but it doesn't appear to have a stack trace.
M-
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using 99% of CPU usually means your program is stuck in a loop. Being hung in a DB query or attempt to connect to the DB would show very low CPU utilization.

No symptom you give suggests GC is the culprit, if you still suspect it why not log memory statistics after every completed update to the database.

Bill
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like William suggests this seems to be a case of an infinite loop that is causing high CPU utilization. You could use jstack to determine which application thread is stuck on the loop.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic