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

javac fails with java.lang.AssertionError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P5 P5
    • None
    • 6
    • tools
    • None
    • generic
    • generic

      We are experiencing 'java.lang.AssertionError' error while compiling VM
      testbase. It does not happen every time but rather often for production
      environment - usually at least once per week on nightly clean builds.

      Note that we were trying to track it down but without luck -
      we always start from clean build (i.e. removing all class files
      before any compilation takes place) but error is not reproduced always.
      However, it always happens at the same place of building process (see below).

      Another note that we observe this error on different platforms.
      Last time it happened on Niagara and before we saw it on linux-i586 and
      linux-amd64 at very least (so probably bug is platform-independent).

      We are using ant to build workspace and ant uses javac API
      (it actually uses "com.sun.tools.javac.Main", see below)
      instead of executing javac executable.

      Here are thesteps how to try to reproduce:

      1. login on one of following machines:
         vmsqe-amd-04.russia.sun.com (linux-i586)
         vmsqe-amd-03.russia.sun.com (linux-amd64)
         vmsqe-t2000.russia.sun.com (solaris-sparcv9)

      2. cd /set/vmsqe/misc/bugs/javac_1/vm_testbase/vm/ant-build

      3. bash build.sh linux-i586 spb classes-all
         or
         bash build.sh linux-amd64 spb classes-all
         or
         bash build.sh solaris-sparc spb classes-all

         build.sh in particular calls 'ant'
         (located in /set/vmsqe/misc/bugs/javac_1/vm_testbase/share/lib/apache-ant-1.6.5)
         and passes the parameters cfg (=linux-i586, ...), cfgset (=spb), target (=classes)

         The full error we get is:

         classes-jdwp:
           [echo] classes: nsk/jdwp
          [javac] Compiling 222 source files to /net/vmsqe.russia/export1/vmsqe/testbase/builds/testbase_SPB_1.6.0-NIGHTLY/vm/bin/classes
          [javac] Note: /net/vmsqe.russia/export1/vmsqe/testbase/builds/testbase_SPB_1.6.0-NIGHTLY/vm/src/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001/clsunload001.java
                  uses or overrides a deprecated API.
          [javac] Note: Recompile with -Xlint:deprecation for details.
          [javac] Compiling 2 source files to /net/vmsqe.russia/export1/vmsqe/testbase/builds/testbase_SPB_1.6.0-NIGHTLY/vm/bin/newclass
           [echo] classes: nsk/jdwp/Method/VariableTable/vartable001
          [javac] Compiling 2 source files to /net/vmsqe.russia/export1/vmsqe/testbase/builds/testbase_SPB_1.6.0-NIGHTLY/vm/bin/classes
           [echo] classes: nsk/jdwp/StackFrame/GetValues/getvalues001
          [javac] Compiling 2 source files to /net/vmsqe.russia/export1/vmsqe/testbase/builds/testbase_SPB_1.6.0-NIGHTLY/vm/bin/classes
           [echo] classes: nsk/jdwp/StackFrame/SetValues/setvalues001
          [javac] Compiling 2 source files to /net/vmsqe.russia/export1/vmsqe/testbase/builds/testbase_SPB_1.6.0-NIGHTLY/vm/bin/classes
           [echo] classes: nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001
          [javac] Compiling 2 source files to /net/vmsqe.russia/export1/vmsqe/testbase/builds/testbase_SPB_1.6.0-NIGHTLY/vm/bin/classes

          [javac] An exception has occurred in the compiler (1.6.0-rc). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)
                  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.

          [javac] java.lang.AssertionError
          [javac] at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2676)
          [javac] at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2616)
          [javac] at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2552)
          [javac] at com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:525)
          [javac] at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:575)
          [javac] at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
          [javac] at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:397)
          [javac] at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2685)
          [javac] at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2616)
          [javac] at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2552)
          [javac] at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1036)
          [javac] at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:765)
          [javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:730)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:328)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:254)
          [javac] at com.sun.tools.javac.main.Main.compile(Main.java:245)
          [javac] at com.sun.tools.javac.Main.compile(Main.java:69)
          [javac] at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
          [javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          [javac] at java.lang.reflect.Method.invoke(Method.java:589)
          [javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:55)
          [javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931)
          [javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:64)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:378)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:64)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:378)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:64)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:378)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:64)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:378)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
          [javac] at org.apache.tools.ant.Task.perform(Task.java:364)
          [javac] at org.apache.tools.ant.Target.execute(Target.java:341)
          [javac] at org.apache.tools.ant.Target.performTasks(Target.java:369)
          [javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
          [javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
          [javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
          [javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
          [javac] at org.apache.tools.ant.Main.runBuild(Main.java:668)
          [javac] at org.apache.tools.ant.Main.startAnt(Main.java:187)
          [javac] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
          [javac] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

          The error happens while we are trying to execute 'classes-jdwp' target
          (which is part of "classes-all" target, see vm/ant-build/all.xml).
          The error always happens at this place.

          Once again, note that we use ant without forking
          javac to compile the sources.
          Indeed ant uses "com.sun.tools.javac.Main" to instantiate Javac
          instance. Still, I'd expect javac to be robust in this mode too.

          Here is source code from ant:

          -------------------------------------------------
          public boolean execute() throws BuildException {
              attributes.log("Using modern compiler", Project.MSG_VERBOSE);
              Commandline cmd = setupModernJavacCommand();

              // Use reflection to be able to build on all JDKs >= 1.1:
              try {
                  Class c = Class.forName ("com.sun.tools.javac.Main");
                  Object compiler = c.newInstance ();
                  Method compile = c.getMethod ("compile",
                      new Class [] {(new String [] {}).getClass ()});
                  int result = ((Integer) compile.invoke
                                (compiler, new Object[] {cmd.getArguments()}))
                      .intValue ();
                  return (result == MODERN_COMPILER_SUCCESS);
              } catch (Exception ex) {
                  if (ex instanceof BuildException) {
                      throw (BuildException) ex;
                  } else {
                      throw new BuildException("Error starting modern compiler",
                                               ex, location);
                  }
              }
          }
          -------------------------------------------------

          Looking at this code the only thing that comes to my mind is that javac
          might have some static state and this state eventually gets corrupted.
          However, this does not explain why this problem is not reproducible
          always on the same set of input data files.

          Let me know if you need any more details.

      -katya

            ahe Peter Ahe
            epavlova Ekaterina Pavlova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: