Missing stack traces after C1 code replaced with C2 code

Ivan Kozik ivan at ludios.org
Fri Mar 21 05:46:11 UTC 2014

There is a long-standing HotSpot bug in tiered compilation when it
upgrades code from tier 3 to tier 4.  After this code upgrade happens,
stack traces are repeatedly thrown away, at least in Clojure programs.

Repro steps are:

wget http://repo2.maven.org/maven2/org/clojure/clojure/1.6.0-RC1/clojure-1.6.0-RC1.jar
rlwrap java -jar clojure-1.6.0-RC1.jar
(inc nil) (pst)

keep repeating (inc nil) (pst) until you see:

NullPointerException   [trace missing]

or, to avoid having to hit Up/Enter as much:

(dotimes [_ 1000] (try (inc nil) (catch Throwable e (.printStackTrace e))))

which will usually require just 2 invocations, but sometimes up to 5.

I see this bug in both IcedTea and Oracle Java 7 and 8, on all of
Ubuntu, Windows 7, and Mountain Lion.  I don't see the bug when
TieredCompilation is turned off, or when it is limited to tier 3.

This was originally discovered in
https://github.com/technomancy/leiningen/issues/1025 and the
workaround (for leiningen users) was to limit the compilation tier.  I
expect that Clojure users will be running into this problem more
frequently now that tiered compilation is on by default.

Unfortunately, I am not familiar with the internals of
to know if Clojure might be doing something peculiar with JVM
bytecode.  It wouldn't be something new; Clojure 1.0, 1.1, 1.2.1, 1.3,
1.4, 1.5.1, and 1.6.0-RC1 are affected.

I originally reported this to bugs.sun.com in February 2013 and it was
assigned internal review ID 2456988.  AFAIK, the bug did not make it
into bugs.sun.com or bugs.openjdk.java.net.  I later asked #openjdk
about it and was told to report it here.



More information about the hotspot-compiler-dev mailing list