JDK-8009204 : [dtrace] signatures returned by Java 7 jstack() are corrupt on Solaris
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: hs24,hs25
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-02-28
  • Updated: 2014-10-14
  • Resolved: 2013-07-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 Other
8Fixed hs25Fixed
Related Reports
Relates :  
Relates :  
Description
jstack() is returning corrupt method signatures on Solaris. To reproduce, you can use DTrace:

dtrace -x jstackstrsize=2048 -Z \
	-n 'hotspot_jni$target::: /0/{}' \
	-n 'syscall::write:entry /pid==$target/{jstack(1024)}' \
	-c 'java -version'

With Java 6, the output is roughly:

             java/io/FileOutputStream.writeBytes([BII)V
             java/io/FileOutputStream.write([BII)V
             java/io/BufferedOutputStream.flushBuffer()V
             java/io/BufferedOutputStream.flush()V
             java/io/PrintStream.write([BII)V

With Java 7, the output is roughly:

             java/io/FileOutputStream.riteBytes
             java/io/FileOutputStream.rite
             java/io/BufferedOutputStream.lushBuffer
             java/io/BufferedOutputStream.lush
             java/io/PrintStream.rite

As you can see, the method names are truncated.

As of 2013-02-27, Solaris is not yet built with Java 7. You can contact me (sam.falkner at oracle dot com) if you need access to a machine that reproduces the bug.
Comments
Tomas, thank you for the details and the suggested fix!
13-06-2013

The problem is caused by SymbolTable changes JDK-6990754. jhelper.d was never updated with changes for CPSlot so the low bit of the address of the Symbol is set which causes the off by 1-ness of the output. The klass name uses a untagged constant pool entry which is why it doesn't have the problem in the output. There is a similar bug JDK-7019165 reported against pstack output.
12-06-2013

Proposed fix attached as jstack.diff. It is based on the fix of JDK-7019165.
12-06-2013