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

os::jvm_path: error in handling -Dsun.java.launcher.is_altjvm option after 8066474

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 9, 10
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • OS:
      linux, os_x, solaris

      Description

      The handling of "-Dsun.java.launcher.is_altjvm=true" in os::jvm_path() is a bit broken after 8066474. The code originally intended that, if the currently loaded (alternate) libjvm.so is located inside a full and valid JRE, the path to that JRE is returned. The Code checks if the currently loaded libjvm.so is part of a jdk by traversing the pathname back 5 slashes and then checking for "/jre/lib":

      2328 const char *p = buf + strlen(buf) - 1;
      2329 for (int count = 0; p > buf && count < 5; ++count) {
      2330 for (--p; p > buf && *p != '/'; --p)
      2331 /* empty */ ;
      2332 }
      2333
      2334 if (strncmp(p, "/jre/lib/", 9) != 0) {

      That coding will not work after removal of the cpu_arch directory and needs fixing.

      However, after extensive discussions (see http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2017-April/023205.html) it was decided to skip this JRE-detection altogether. -Dsun.java.launcher.is_altjvm=true is used by the gtest launcher to indicate that the path to the JRE is not to be taken from the location of the currently loaded gtest-hotspot, but from a different location. This different location is indicated via JAVA_HOME variable by the gtest launcher (which in turn is fed from the "-jdk" option of the gtest runner).

      Note that this has nothing to do with the -XXaltjvm setting.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                stuefe Thomas Stuefe
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: