Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6703104

Java hang as per old bugs.sun.com Solaris bug

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • solaris_11
    • hotspot
    • sparc
    • solaris_nevada

      Category
         library
      Sub-Category
         libc
      Description
         We're seeing a Java hang on Java 1.4.2_11 and similar versions under OpenSolaris that we don't see on Solaris 10; we've seen it in a Java installer on a real app but have managed to find that the test code in the code attached to
       bugs.sun.com bug 4317961:
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4317961
      also exhibits a similar hang.
        That bug suggests it was fixed years ago in much earlier versions of Java; and as I say it works on Sol 10.
      We noticed that during the hang it was often in thr_getstate()
      A colleague wondered if the problem might be related to getgregs and noticed it only copies some of the registers; he added copying of other registers and noticed
      adding nPC seemed to fix the hang - but it would be nice if we understood why this was the case.
      Frequency
         Always
      Regression
         Solaris 10
      Steps to Reproduce
         Run the code on:
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4317961
      in java 1.4.2 on SPARC - it hangs. (Note I seems the classname got changed given what it is calling in main on the oriignal bug?)
      public class sf {
              static public boolean _xx = true;
      public static void main(String[] args) {
      new sf().start();
      }
      public void start() {
      new TesterThread().start();
      new GCThread().start();
      }
      class TesterThread extends Thread {
                      // trick compiler 2 in believing that this is not and endless loop
                      public void loop (int n) {
      long counter = 0;
      while (_xx) {
      if (n == 0) {
                                        _xx = false;
                                      }
      }
                      }
      public void run () {
      System.out.println("Start loop");
                              loop(3);
      }
      }
      class GCThread extends Thread {
      public void run () {
      System.out.println("Starting GC loop");
      long counter = 0;
      while (true) {
        try { sleep(250); } catch (InterruptedException ix) {}
      System.gc();
                                      counter++;
                                      if (counter == 10) {
                                        _xx = false;
                                        return;
                                      }
      }
      }
      }
      Expected Result
         Start loop
      Starting GC loop
      a few lines of GC diag and then exit after a few seconds.
      Actual Result
         Hangs reliably.
      Error Message(s)
         
      Test Case
         from: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4317961
      public class sf {
              static public boolean _xx = true;
      public static void main(String[] args) {
      new sf().start();
      }
      public void start() {
      new TesterThread().start();
      new GCThread().start();
      }
      class TesterThread extends Thread {
                      // trick compiler 2 in believing that this is not and endless loop
                      public void loop (int n) {
      long counter = 0;
      while (_xx) {
      if (n == 0) {
                                        _xx = false;
                                      }
      }
                      }
      public void run () {
      System.out.println("Start loop");
                              loop(3);
      }
      }
      class GCThread extends Thread {
      public void run () {
      System.out.println("Starting GC loop");
      long counter = 0;
      while (true) {
        try { sleep(250); } catch (InterruptedException ix) {}
      System.gc();
                                      counter++;
                                      if (counter == 10) {
                                        _xx = false;
                                        return;
                                      }
      }
      }
      }
      Workaround
         
      Submitter wants to work on bug
         No
      Additional configuration information

            kvn Vladimir Kozlov
            bcorwin Bonnie Corwin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: