4 Replies Latest reply: Oct 27, 2009 11:59 PM by 796365 RSS

    Program hangs, can't get thread dump

    843798
      Hello

      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 process with Java Visual VM - doesn't help too (just says 'Connecting...' forever).

      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.

      Edited by: Yulia_Dubinina on Oct 26, 2009 11:58 PM

      Edited by: Yulia_Dubinina on Oct 27, 2009 12:13 AM
        • 1. Re: Program hangs, can't get thread dump
          843798
          Yesterday I tried to start my program, connect with Java Visual VM to it 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 tried to press Thread Dump button, it worked, but there was nothing 'criminal' on the dump it provided. So I guess maybe it's not actual thread dump, it's something that Java Visual VM was able to get before process hanged.

          I don't have much experience in resolving this kind of problems, so any advices will be great appreciated.

          Edited by: Yulia_Dubinina on Oct 27, 2009 2:14 PM
          • 2. Re: Program hangs, can't get thread dump
            796365
            What else can I do to find out what's going on in my programm and fix it?
            Try commenting out portions of the program and locate the area that's causing the problem. Most of the time a study of the involved code will produce useful results.
            • 3. Re: Program hangs, can't get thread dump
              791266
              Yulia_Dubinina wrote:
              Yesterday I tried to start my program, connect with Java Visual VM to it 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 tried to press Thread Dump button, it worked, but there was nothing 'criminal' on the dump it provided. So I guess maybe it's not actual thread dump, it's something that Java Visual VM was able to get before process hanged.

              I don't have much experience in resolving this kind of problems, so any advices will be great appreciated.

              Edited by: Yulia_Dubinina on Oct 27, 2009 2:14 PM
              Turn on verbose GC and see if you got lots and lots of full GC when the freeze happens. A full GC can take several minutes if you have a bad configuration (where e.g. memory has been paged out to disk)
              • 4. Re: Program hangs, can't get thread dump
                843798
                Turn on verbose GC and see if you got lots and lots of full GC when the freeze happens. A full GC can take several minutes if you have a bad configuration (where e.g. memory has been paged out to disk)
                Try commenting out portions of the program and locate the area that's causing the problem. Most of the time a study of the involved code will produce useful results.>
                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