United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7062856 Disassembler needs to be smarter about finding hsdis after 1.7 launcher changes
7062856 : Disassembler needs to be smarter about finding hsdis after 1.7 launcher changes

Details
Type:
Bug
Submit Date:
2011-07-05
Status:
Closed
Updated Date:
2011-11-25
Project Name:
JDK
Resolved Date:
2011-09-30
Component:
hotspot
OS:
solaris_10
Sub-Component:
compiler
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs22
Fixed Versions:
hs22

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
This looks like a bug in disassembler.cpp that was masked by how LD_LIBRARY_PATH was setup by older JDKs.  The 1.6 launcher always setup the LD_LIBRARY_PATH to point into jre/lib/<arch> and jre/lib/<arch>/<vm> but the 1.7 one doesn't.  It relies on $ORIGIN and some extra smarts to avoid having to re-exec to setup LD_LIBRARY_PATH.  This is 6367077.

The bug is that when hotspot looks for hsdis next to libjvm.so it's not stripping the lib path of the path so it tries to open libhsdis-i386.so.

/7:     open("/net/jre.us.oracle.com/p/v33/jdk/6_14/fcs/b08/binaries/solaris-amd64/fastdebug/jre/lib/i386/client/libhsdis-i386.so", O_RDONLY|O_NONBLOCK) Err#2 ENOENT

It then falls back to an LD_LIBRARY_PATH lookup on hsdis-i386.so which in 1.6 will find it next to libjvm.so or even in jre/lib/<arch> but which will fail in 1.7.

tom

On Jul 2, 2011, at 5:14 AM, Krystal Mok wrote:

> Hi all,
> 
> I used to build the hsdis library and put it along side $LIBARCH/libjvm.so and it worked fine.
> 
> But when I was trying it out today with JDK7 build 147 x64 on Ubuntu, putting hsdis-amd64.so along side libjvm.so didn't work.
> The log says:
> Could not load hsdis-amd64.so; library not loadable; PrintAssembly is disabled
> 
> Instead, setting LD_LIBRARY_PATH to the where hsdis-amd64.so is in did work like before. e.g.
> $ export LD_LIBRARY_PATH=.:/home/sajia/jdk/7b147_x64_debug/fastdebug/jre/lib/amd64/server
> 
> I'm not sure from which version it started to behave like this, or which platforms are affected.
> 
> On the same machine, JDK6u25 can load the same hsdis-amd64.so from along side libjvm.so without problem.
> Then I copied libjvm.so from JDK7b147 to my JDK6u25 installation and tried again:
> 
> $ echo $LD_LIBRARY_PATH
> 
> $ java -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly | head -n5
> Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output
> VM option '+UnlockDiagnosticVMOptions'
> VM option '+PrintAssembly'
> Loaded disassembler from hsdis-amd64.so
> Decoding compiled method 0x00002aaaab118910:
> $ java -version
> java version "1.6.0_25"
> Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
> Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17-fastdebug, mixed mode)
> 
> And it worked. And then doing the reverse, copied the libjvm.so to JDK7b147's installation:
> 
> $ export JAVA_HOME=~/jdk/7b147_x64_debug/fastdebug
> $ export PATH=$JAVA_HOME/bin:$PATH
> $ echo $LD_LIBRARY_PATH
> 
> $ java -version
> java version "1.7.0-fastdebug"
> Java(TM) SE Runtime Environment (build 1.7.0-fastdebug-b147)
> Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
> $ ls $JAVA_HOME/jre/lib/amd64/server/
> hsdis-amd64.so  libjsig.so  libjvm.so  libjvm.so.orig  Xusage.txt
> $ java -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly | head -n5
> Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output
> Could not load hsdis-amd64.so; library not loadable; PrintAssembly is disabled
> 
> From that I'd guess it's a JDK7-only behavior; doesn't seem to be a HotSpot VM problem.
> Does anybody have a clue on this?
> 
> Regards,
> Kris Mok

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/3e23978ea0c3
                                     
2011-07-08
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/3e23978ea0c3
                                     
2011-07-07
EVALUATION

7062856: Disassembler needs to be smarter about finding hsdis after 1.7 launcher changes
Summary: do explicit lookup emulating old LD_LIBRARY_PATH search
Reviewed-by: kvn, jrose

Changes to launcher in the JDK7 removed the default setting of
LD_LIBRARY_PATH which was being used to find the disassembler.  I
added explicit logic to perform a lookup equivalent to the previous
behaviour.  Tested with truss to confirm search paths and
PrintNMethods.

I also fixed an annoyance where every separate invocation of the
disassembler emitted the "Disassembling ..." message so that it would
only print it again if it changed.
                                     
2011-07-07
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/3e23978ea0c3
                                     
2011-07-07
EVALUATION

Description is correct.
                                     
2011-07-05
WORK AROUND

Use LD_LIBRARY_PATH to point at hsdis or name is libhsdis-<arch>.so when placing it next to libjvm.so
                                     
2011-07-05



Hardware and Software, Engineered to Work Together