JDK-6598663 : jdk1.5.0_12 : 'java -version:1.5+' failure dependent of length of HOME env var
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 5.0u3,5.0u12
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,solaris
  • CPU: generic
  • Submitted: 2007-08-29
  • Updated: 2012-10-09
  • Resolved: 2007-09-06
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
most recent updatemanager patches 121118-13/121119-13 use the command fragment 'java -version:1.5+' to launch the application, and some users on x86 are now experiencing a problem where the application fails to launch, see

http://forum.java.sun.com/thread.jspa?threadID=5209110&start=0&tstart=0

updatemanager is not implicated in the underlying cause of the problem, but is serving to expose the issue -- the problem itself can easily be reproduced on x86 with the following piece of shell script

----
x=0 ; HOME=/ ; while [ $x -lt 40 ] ; do  echo HOME=$HOME; export HOME; java -version:1.5+ > /dev/null; HOME=${HOME}x; (( x+=1 )); done
----

where HOME env var values of particular _length_ result in errors like

Unable to resolve /usr/jdk/jdk1.5.0_12
Unable to resolve /usr/jdk/jdk1.5.0_12

Comments
WORK AROUND add -jre-restrict-search to your command line.
11-09-2007

EVALUATION This is a duplicate of "6431847 Memory overflow in java launcher for Linux"
29-08-2007

SUGGESTED FIX % sccsdiff -r1.75 -r1.74 SCCS/s.java_md.c ------- java_md.c ------- 1500,1501c1500 < path = (char *)JLI_MemAlloc(strlen(home) + strlen(system_dir) + < strlen(user_dir) + 2); --- > path = (char *)JLI_MemAlloc(strlen(home) + 13);
29-08-2007

EVALUATION This does not reproduce on JDK6 or JDK7. Also, it appears to be in the launcher code, not the VM itself. You can see that libjvm.so is never even opened using dtrace: First a non-failing run where libjvm.so is opened: > HOME=/xx dtrace -n 'pid$target::dlopen:entry {printf("%s\n", copyinstr(arg0));}' -c "/usr/bin/java -version" dtrace: description 'pid$target::dlopen:entry ' matched 1 probe java version "1.5.0_07" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03) Java HotSpot(TM) Server VM (build 1.5.0_07-b03, mixed mode) dtrace: pid 7330 has exited CPU ID FUNCTION:NAME 4 38655 dlopen:entry /usr/jdk/instances/jdk1.5.0/jre/lib/i386/server/libjvm.so 4 38655 dlopen:entry libdl.so 4 38655 dlopen:entry /usr/jdk/instances/jdk1.5.0/jre/lib/i386/native_threads/libhpi.so 4 38655 dlopen:entry /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libverify.so 4 38655 dlopen:entry /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libjava.so dtrace: error on enabled probe ID 5 (ID 38655: pid7330:LM1`ld.so.1:dlopen:entry): invalid address (0xff) in action #1 at DIF offset 28 4 38655 dlopen:entry /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libzip.so 4 38655 dlopen:entry /usr/lib/libc.so 4 38655 dlopen:entry /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libzip.so Now a run with the -version:1.5 string that fails: > HOME=/xx dtrace -n 'pid$target::dlopen:entry {printf("%s\n", copyinstr(arg0));}' -c "/usr/bin/java -version:1.5 -version" dtrace: description 'pid$target::dlopen:entry ' matched 1 probe dtrace: pid 7339 has exited
29-08-2007

WORK AROUND set env var JAVA_VERSION_PATH directly, export JAVA_VERSION_PATH=$HOME/jdk:/usr/jdk or bump length of HOME env var HOME=/$HOME
29-08-2007