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

NMT: VM.native_memory crashes on assert if functionality isn't supported by OS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 22
    • 22
    • hotspot
    • b23

      Reproduced locally with my Ubuntu on WSL, but I guess it can happen on other systems as well.

      To reproduce, just call 'jcmd AppName VM.native_memory' against a java process, and get something like this:

      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/mnt/c/wsl/jdk/open/src/hotspot/os/linux/os_linux.cpp:3379), pid=2026, tid=2054
      # assert(mincore_return_value == 0) failed: Range must be valid
      #
      ...
      Stack: [0x00007fa92da30000,0x00007fa92db31000], sp=0x00007fa92db2eae0, free space=1018k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x149c298] os::committed_in_range(unsigned char*, unsigned long, unsigned char*&, unsigned long&)+0x2a8 (os_linux.cpp:3379)
      V [libjvm.so+0x185d043] VirtualMemorySummary::snapshot(VirtualMemorySnapshot*)+0x263 (virtualMemoryTracker.cpp:614)
      V [libjvm.so+0x1368612] MemBaseline::baseline(bool)+0x232 (memBaseline.cpp:150)
      V [libjvm.so+0x1429366] NMTDCmd::report(bool, unsigned long)+0x1a6 (nmtDCmd.cpp:151)
      V [libjvm.so+0x1429d3c] NMTDCmd::execute(DCmdSource, JavaThread*)+0x1bc (nmtDCmd.cpp:112)
      V [libjvm.so+0xb6d5d1] DCmd::parse_and_execute(DCmdSource, outputStream*, char const*, char, JavaThread*)+0x201 (diagnosticFramework.cpp:409)
      V [libjvm.so+0x6b3a5e] jcmd(AttachOperation*, outputStream*)+0x4e (attachListener.cpp:204)
      V [libjvm.so+0x6b543f] AttachListenerThread::thread_entry(JavaThread*, JavaThread*)+0x26f (attachListener.cpp:413)
      V [libjvm.so+0xebcb3c] JavaThread::thread_main_inner()+0xcc (javaThread.cpp:720)
      V [libjvm.so+0x1790fda] Thread::call_run()+0xba (thread.cpp:220)
      V [libjvm.so+0x149f66a] thread_native_entry(Thread*)+0x12a (os_linux.cpp:785)

      The root cause is this call to 'mincore':

      // Get stable read
      while ((mincore_return_value = mincore(loop_base, pages_to_query * page_sz, vec)) == -1 && errno == EAGAIN);

      ... that returns -1 and makes errno equal to "ENOSYS 38 Function not implemented". Afterwards, the JVM crashes on a subsequent assert:

      assert(mincore_return_value == 0, "Range must be valid");

      Don't know if that is really a bug (how many *nix'es return '-1' here?), so feel free to close if it is not relevant. But my gut feeling says that we could process this situation in a better way.

            azafari Afshin Zafari
            enikitin Evgeny Nikitin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: