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

javac is not thread-safe

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.1
    • 1.4.1
    • tools
    • hopper
    • generic
    • generic
    • Verified



      Name: poR10007 Date: 03/07/2002



      Javac (JDK1.4.1-b03) is not thread-safe. It ittermitently fails
      to compile java sources running in different threads. Attempts
      to compile files in multi-thread application result in different
      error messages from the compiler. These messages vary from run to
      run - syntax errors, NullPointerException etc.

      Javac is used by Jmpp tool of JCK team. Since this tool is used
      in JCK build it should be able to run in parallel. Currently we
      have to workaround the problem with javac but lack of possibility
      to compile sources in parallel slows down the new JCK build. We have
      several thousands of Jmpp templates in JCK so running Jmpp tool
      in different threads of sameJVM could speed up the build greatly.

      To reproduce the problem please use run.sh script from the attachment.
      It compiles SameVMTest class which starts javac in different threads,
      and runs it. You may specify the number of threads running changing
      MAXJOBS definition in the script.

      The sample log of script execution is the following:
      ------------------------------------------------------------------------------
      $ ./run.sh
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b03)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b03, mixed mode)
      Thread 0 starting the next iteration
      Thread 3 starting the next iteration
      Thread 2 starting the next iteration
      Thread 1 starting the next iteration
      An exception has occurred in the compiler (1.4.1-beta). Please file a bug at the Java Developer Connection
      (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following
      diagnostic in your report. Thank you.
      java.lang.NullPointerException
              at com.sun.tools.javac.v8.comp.Enter._case(Enter.java:484)
              at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:435)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:440)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:454)
              at com.sun.tools.javac.v8.comp.Enter._case(Enter.java:469)
              at com.sun.tools.javac.v8.tree.Tree$TopLevel.visit(Tree.java:382)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:440)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:454)
              at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:579)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:376)
              at com.sun.tools.javac.v8.Main.compile(Main.java:526)
              at com.sun.tools.javac.Main.compile(Main.java:32)
              at SingleRun.run(SameVMTest.java:163)
      An exception has occurred in the compiler (1.4.1-beta). Please file a bug at the Java Developer Connection
      (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following
      diagnostic in your report. Thank you.
      java.lang.NullPointerException
              at com.sun.tools.javac.v8.comp.Enter._case(Enter.java:484)
              at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:435)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:440)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:454)
              at com.sun.tools.javac.v8.comp.Enter._case(Enter.java:469)
              at com.sun.tools.javac.v8.tree.Tree$TopLevel.visit(Tree.java:382)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:440)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:454)
              at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:579)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:376)
              at com.sun.tools.javac.v8.Main.compile(Main.java:526)
              at com.sun.tools.javac.Main.compile(Main.java:32)
              at SingleRun.run(SameVMTest.java:163)
      Error (Thread 0): javac return status = 4
      Error (Thread 2): javac return status = 4
      An exception has occurred in the compiler (1.4.1-beta). Please file a bug at the Java Developer Connection
      (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following
      diagnostic in your report. Thank you.
      java.lang.NullPointerException
              at com.sun.tools.javac.v8.comp.Enter._case(Enter.java:484)
              at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:435)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:440)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:454)
              at com.sun.tools.javac.v8.comp.Enter._case(Enter.java:469)
              at com.sun.tools.javac.v8.tree.Tree$TopLevel.visit(Tree.java:382)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:440)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:454)
              at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:579)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:376)
              at com.sun.tools.javac.v8.Main.compile(Main.java:526)
              at com.sun.tools.javac.Main.compile(Main.java:32)
              at SingleRun.run(SameVMTest.java:163)
      Error (Thread 1): javac return status = 4
      An exception has occurred in the compiler (1.4.1-beta). Please file a bug at the Java Developer Connection
      (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following
      diagnostic in your report. Thank you.
      java.lang.NullPointerException
              at com.sun.tools.javac.v8.code.ClassReader.includeClassFile(ClassReader.java:1096)
              at com.sun.tools.javac.v8.code.ClassReader.list(ClassReader.java:1151)
              at com.sun.tools.javac.v8.code.ClassReader.listAll(ClassReader.java:1242)
              at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1262)
              at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:980)
              at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:375)
              at com.sun.tools.javac.v8.comp.Enter._case(Enter.java:468)
              at com.sun.tools.javac.v8.tree.Tree$TopLevel.visit(Tree.java:382)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:440)
              at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:454)
              at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:579)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:376)
              at com.sun.tools.javac.v8.Main.compile(Main.java:526)
              at com.sun.tools.javac.Main.compile(Main.java:32)
              at SingleRun.run(SameVMTest.java:163)
      Error (Thread 3): javac return status = 4
      $
      ------------------------------------------------------------------------------
        
      ======================================================================

            gafter Neal Gafter (Inactive)
            passunw Pas Pas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: