32-bit JDK fails to launch on large file system

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8, 11, 17, 18, 19
    • Component/s: tools

      When running on a large file system:

      $ ./jre1.8.0_331/bin/java -version
      Error: missing `server' JVM at `/scratch/iklam/re/jre1.8.0_331/lib/i386/server/libjvm.so'.
      Please install or use the JRE or JDK that contains these missing components.
      $ df .
      Filesystem 1K-blocks Used Available Use% Mounted on
      /dev/sdb 4292880368 1561098452 2731781916 37% /scratch
      $ uname -a
      Linux hotspot-oraclelinux-04 4.14.35-1902.2.0.el7uek.x86_64 #2 SMP Fri Jun 14 21:15:44 PDT 2019 x86_64 x86_64 x86_64 GNU/Linux

      But it works when the JDK is copied to a small file system

      $ cd /tmp
      $ df .
      Filesystem 1K-blocks Used Available Use% Mounted on
      /dev/sda3 40223552 19385688 20837864 49% /
      $ ./jre1.8.0_331/bin/java -version
      java version "1.8.0_331-ea"
      Java(TM) SE Runtime Environment (build 1.8.0_331-ea-b03)
      Java HotSpot(TM) Server VM (build 25.331-b03, mixed mode)

      ======================================
      Analysis:

      The same problem exists for JDK 8 ~ latest. The problem is here:

      https://github.com/iklam/jdk/blame/63009f90ec7df053c936226663b463b8584364a9/src/java.base/unix/native/libjli/java_md.c#L481

          if (stat(jvmpath, &s) == 0) {
              JLI_TraceLauncher("yes.\n");
              return JNI_TRUE;
          } else {
              JLI_TraceLauncher("no.\n");
              return JNI_FALSE;
          }


      On 32-bit builds, we have

      struct stat {
      unsigned long st_dev; /* Device. */
      unsigned long st_ino; /* File serial number. */

      On a large file system where st_ino exceeds 32-bit, stat() in a 32-bit build returns -1 with error code EOVERFLOW.

      =============================================
      Suggested fix:

      Calls to stat() should be changed to stat64()

      (The above example is in libjli, but we have many calls to stat() in various parts of the JDK).

            Assignee:
            Unassigned
            Reporter:
            Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: