I have a Java program which sometimes works OK untill the very end, but sometimes just hangs in a random moment and doesn't react to Ctrl+C or Ctrl+Break. Process doesn't use CPU, so I guess it isn't something like infinite loop (I actually cannot think of places in my program where this kind of loop may occur). I tried to get thread dump to see if there are any deadlocks, but Ctrl+Break doesn't work and jstack doesn't work also (I've read that there is -F option, but it isn't available on Windows). Also I tried to connect to a hanged process with Java Visual VM - doesn't help too (just says 'Connecting...' forever).
I tried to start my program, connect with Java Visual VM to it at the beginning and see how threads visualisation will look like in a moment when program hangs. My programm died after about 50 min and all info which I was able to see was about this period of time (e.g. a timeline diagram stopped changing and the last time mark was 49:23), but Java Visual VM was still connected to a process. I pressed Thread Dump button, it worked, but there was nothing 'criminal' on the dump it provided. So I guess maybe it is not actual thread dump, it is something that Java Visual VM was able to get before process hanged.
What else can I do to find out what's going on in my programm and fix it?
I tried to run it with JDK 1.6.0_07 and 1.6.0_16. I'm using Windows Vista Enterprise SP1, 64-bit.
Thanks in advance, Yulia.
Sprinkle some System.out.println( ... ) statements in the busiest parts of your program, let it run and see what happens ...
Tried it, but still can't figure out why it hangs. I've builded my programm on JDK 1.5 instead of 1.6 and have been using it for 2 weeks - no hangs so far... Hope it will keep working this way :)
Originally Posted by JosAH