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

Linux: Unexpected error appears when running java under SMP computer

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description



      Name: iaR10016 Date: 06/15/2000



      JDK version:
      java version "1.3.0beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b07)
      Java HotSpot(TM) Client VM (build 1.3.0beta-b04, mixed mode)

      OS version:
      RedHat Linux 6.1

      The following test example calls Runtime.exec() method several times.
      Test process hangs 8 from 10 times when running on SMP computer.
      Please note that output of the test differs from time to time.
      In most cases process hangs without any error message. Sometimes
      it hangs with the following messages:

      ...
      # # An unexpected exception has been detected in native code outside the VM.# Program counter=0x400202a6
      #
      # Problematic Thread: prio=1 tid=0x804ea00 nid=0x400 waiting on monitor
      #
      ...

      or

      ...
      java.lang.IllegalMonitorStateException
              at java.lang.Object.notifyAll(Native Method)
              at java.io.PipedOutputStream.flush(PipedOutputStream.java:145)
              at java.lang.ProcessInputStream.run(UNIXProcess.java:363)
              at java.lang.Thread.run(Thread.java:484)
      ...

      Om single-processor computer the test always runs correctly.

      --------------------------------- test.java -------------------------------

      import java.io.*;

      public class test {

          private static int nTests = 150;

          public static void run() {
              for (int i=1; i <= nTests; i++) {
                  try {
                      Process child = Runtime.getRuntime().exec("java tested");
                      InputStream in =child.getInputStream();
                      InputStream err = child.getErrorStream();
                      int c;
                      while (true) {
                              while (( c=in.read() ) != -1 ) System.out.write((char)c) ;
                              while (( c=err.read() ) != -1 ) System.out.write((char)c) ;
                              try {
                                  int l = child.exitValue();
                                  while (( c=in.read() ) != -1 ) System.out.write((char)c) ;
                                  while (( c=err.read() ) != -1 ) System.out.write((char)c) ;
                                  break;
                              }
                              catch (IllegalThreadStateException e) {}
                      }
                      in.close();
                      err.close();
                      System.out.println("Passed: " + i);
                  } catch (Exception e) {
                      System.out.println(e);
                  }
              }
          }

          public static void main(String args[]) {
              if (args.length > 0) nTests=(new Integer(args[0])).intValue();
              test.run();
          }
      }

      ------------------------ tested.java --------------------------------------

      public class tested {
          public static void main(String [] args) {
              try {
                  Thread.sleep(10);
                  System.out.println("Hello! I' m a test!!!!!");
              }
              catch (Exception e) {
                  System.out.println(e);
              }
          }
      }

      ------------------------- Sample output ------------------------------------
      ...
      $ javac tested.java
      $ javac test.java
      $ java test
      Hello! I' m a test!!!!!
      Passed: 1
      Hello! I' m a test!!!!!
      Passed: 2
      Hello! I' m a test!!!!!
      Passed: 3
      Hello! I' m a test!!!!!
      Passed: 4
      ...
      Passed: 64
      Hello! I' m a test!!!!!
      Passed: 65
      Hello! I' m a test!!!!!
      Passed: 66
      Hello! I' m a test!!!!!
      Passed: 67
      Hello! I' m a test!!!!!
      ^C
      $
      ------------------------------------------------------------------------------
      $ java test 150
      Hello! I' m a test!!!!!
      Passed: 1
      Hello! I' m a test!!!!!
      Passed: 2
      Hello! I' m a test!!!!!
      Passed: 3
      Hello! I' m a test!!!!!
      Passed: 4
      ...
      Hello! I' m a test!!!!!
      Passed: 102
      Hello! I' m a test!!!!!
      Passed: 103
      Hello! I' m a test!!!!!
      Passed: 104
      # # An unexpected exception has been detected in native code outside the VM.# Program counter=0x400202a6
      #
      # Problematic Thread: prio=1 tid=0x804ea00 nid=0x400 waiting on monitor
      #
      $
      --------------------------------------------------------------------------------
      $ java test
      Hello! I' m a test!!!!!
      Passed: 1
      Hello! I' m a test!!!!!
      Passed: 2
      Hello! I' m a test!!!!!
      Passed: 3
      Hello! I' m a test!!!!!
      Passed: 4
      ...
      Hello! I' m a test!!!!!
      Passed: 70
      Hello! I' m a test!!!!!
      Passed: 71
      Hello! I' m a test!!!!!
      java.lang.IllegalMonitorStateException
              at java.lang.Object.notifyAll(Native Method)
              at java.io.PipedOutputStream.flush(PipedOutputStream.java:145)
              at java.lang.ProcessInputStream.run(UNIXProcess.java:363)
              at java.lang.Thread.run(Thread.java:484)
      ^C
      $
      ...
      ----------------------------------------------------------------------------

      Permissions tests from Security testsuite fail because of this bug when running on SMP computer.

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                duke J. Duke (Inactive)
                Reporter:
                irasunw Ira Ira (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: