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

Parallel: Crash during pretouch after large pages allocation failure

XMLWordPrintable

    • gc
    • b17

      Seen this in many configurations in current testing:

      $ build/linux-x86_64-server-fastdebug/images/jdk/bin/java -XX:+AlwaysPreTouch -Xmx2g -XX:+UseLargePages -XX:LargePageSizeInBytes=1g -XX:+UseParallelGC
      OpenJDK 64-Bit Server VM warning: Failed to reserve and commit memory. req_addr: 0x0000000080000000 bytes: 2147483648 page size: 1073741824 (errno = 12).
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00007f7f557f7cda, pid=3987099, tid=3987101
      #
      # JRE version: (19.0) (fastdebug build )
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 19-internal+0-adhoc.shade.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, parallel gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x1600cda] os::pretouch_memory(void*, void*, unsigned long)+0x1ea

      Bisection points to JDK-8272807.

      I believe this is due to LargePages allocation failure. The new pretouching code still rounds down to still-large page size, which touches memory out of heap bounds. This looks to be a problem with Parallel GC (and maybe others), not G1.

      See, adding this assert:

          for ( ; true; cur += page_size) {
            assert(cur >= start, "sanity: " PTR_FORMAT " in " PTR_FORMAT " ... " PTR_FORMAT, p2i(cur), p2i(start), p2i(end));
            Atomic::add(reinterpret_cast<int*>(cur), 0, memory_order_relaxed);
            if (cur >= last) break;
          }

      ...crashes with:

      # Internal Error (/home/shade/trunks/jdk/src/hotspot/share/runtime/os.cpp:1766), pid=4062942, tid=4062944
      # assert(cur >= start) failed: sanity: 0x00000000c0000000 in 0x00000000d5600000 ... 0x00000000f5800000

            tschatzl Thomas Schatzl
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: