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

JMH Benchmark crashes (first iterations) with large page support

    XMLWordPrintable

    Details

    • Subcomponent:
      gc
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 , 64 bit Build 19041 (10.0.19041.804)
      OJDK (16.0+36)

      A DESCRIPTION OF THE PROBLEM :
      Running an JMH Benchmark with larges parges (4M - enabled for the current user) will crash the frist two iterations when runnig from a windows command line.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      * Compile the project with JDK16 (-source 15) (It's a eclipse project - pls contact me if you need the project - stefan2110@gmx.de)
      * enable large page support for the current user
      * run the benchmark with a cmd/batch file (windows)

      ----
      @echo off
      cd E:\Profile\eclipse\jdk11\testjmh
      echo START!!
      echo java16
      echo ojdk-16ea36
      "C:\Program Files\Java\ojdk-16ea36\bin\java.exe" -server -XX:+UseLargePages -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:-UsePerfData -XX:-IgnoreUnrecognizedVMOptions -XX:LargePageSizeInBytes=4m -XX:+OptimizeStringConcat -XX:+UseNUMA -Xmn2g -Xms4g -Xmx4g -Dfile.encoding=UTF-8 -p E:\Profile\eclipse\jdk11\testjmh\target\classes;C:\Users\Stefa\.m2\repository\org\openjdk\jmh\jmh-core\1.23\jmh-core-1.23.jar -classpath C:\Users\Stefa\.m2\repository\net\sf\jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar;C:\Users\Stefa\.m2\repository\org\apache\commons\commons-math3\3.2\commons-math3-3.2.jar;C:\Users\Stefa\.m2\repository\org\openjdk\jmh\jmh-generator-annprocess\1.23\jmh-generator-annprocess-1.23.jar -m testjmh/de.sph.testjmh.Main
      echo ---
      ---

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      running benchmark
      ACTUAL -
      crash report (large page not aligned)
      ----
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (g1PageBasedVirtualSpace.cpp:50), pid=18576, tid=4300
      # guarantee(is_aligned(rs.base(), page_size)) failed: Reserved space base 0x000002a4d3600000 is not aligned to requested page size 4194304
      #
      # JRE version: (16.0+36) (build )
      # Java VM: OpenJDK 64-Bit Server VM (16+36-2231, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
      # No core dump will be written. Minidumps are not enabled by default on client versions of Windows
      #
      #

      --------------- S U M M A R Y ------------

      Command Line: -XX:+UseLargePages -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:-UsePerfData -XX:-IgnoreUnrecognizedVMOptions -XX:LargePageSizeInBytes=4m -XX:+OptimizeStringConcat -XX:+UseNUMA -Xmn2g -Xms4g -Xmx4g -Dfile.encoding=UTF-8 --module-path=E:\Profile\eclipse\jdk11\testjmh\target\classes;C:\Users\Stefa\.m2\repository\org\openjdk\jmh\jmh-core\1.23\jmh-core-1.23.jar -Djdk.module.main=testjmh -XX:CompileCommandFile=C:\Users\Stefa\AppData\Local\Temp\jmh885832583825827886compilecommand org.openjdk.jmh.runner.ForkedMain 127.0.0.1 53197

      Host: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz, 12 cores, 63G, Windows 10 , 64 bit Build 19041 (10.0.19041.804)
      Time: Sun Feb 28 11:38:07 2021 Mitteleuropäische Zeit elapsed time: 0.006876 seconds (0d 0h 0m 0s)

      --------------- T H R E A D ---------------

      Current thread (0x000002a4bc87cbf0): JavaThread "Unknown thread" [_thread_in_vm, id=4300, stack(0x000000e238600000,0x000000e238700000)]

      Stack: [0x000000e238600000,0x000000e238700000]
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [jvm.dll+0x6681da]
      V [jvm.dll+0x7c9d99]
      V [jvm.dll+0x7cb4d3]
      V [jvm.dll+0x7cbae7]
      V [jvm.dll+0x242e4c]
      V [jvm.dll+0x2fbcb7]
      V [jvm.dll+0x302e7d]
      V [jvm.dll+0x3035aa]
      V [jvm.dll+0x2d0038]
      V [jvm.dll+0x2d3e77]
      V [jvm.dll+0x79c691]
      V [jvm.dll+0x3607b1]
      V [jvm.dll+0x77a370]
      V [jvm.dll+0x3e501f]
      V [jvm.dll+0x3e6af1]
      C [jli.dll+0x52fb]
      C [ucrtbase.dll+0x21bb2]
      C [KERNEL32.DLL+0x17034]
      C [ntdll.dll+0x52651]


      --------------- P R O C E S S ---------------

      Threads class SMR info:
      _java_thread_list=0x00007ffd3ad1cbb8, length=0, elements={
      }

      Java Threads: ( => current thread )

      Other Threads:

      [error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd3aa080ea]

      VM state: not at safepoint (not fully initialized)

      VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
      [0x000002a4bc878e20] Heap_lock - owner thread: 0x000002a4bc87cbf0

      Heap address: 0x0000000700000000, size: 4096 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
      CDS archive(s) mapped at: [0x0000000000000000-0x0000000000000000-0x0000000000000000), size 0, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 0.
      Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0x0

      GC Precious Log:
      <Empty>

      Heap:
       garbage-first heap total 0K, used 0K [0x0000000000000000, 0x0000000000000000)
        region size 2048K, 0 young (0K), 0 survivors (0K)

      [error occurred during error reporting (printing heap information), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd3a8d1edd]

      GC Heap History (0 events):
      No events

      Deoptimization events (0 events):
      No events

      Classes unloaded (0 events):
      No events

      Classes redefined (0 events):
      No events

      Internal exceptions (0 events):
      No events

      Events (1 events):
      Event: 0.005 Loaded shared library C:\Program Files\Java\ojdk-16ea36\bin\java.dll


      Dynamic libraries:
      0x00007ff650190000 - 0x00007ff65019e000 C:\Program Files\Java\ojdk-16ea36\bin\java.exe
      0x00007ffda8970000 - 0x00007ffda8b65000 C:\WINDOWS\SYSTEM32\ntdll.dll
      0x00007ffda6de0000 - 0x00007ffda6e9d000 C:\WINDOWS\System32\KERNEL32.DLL
      0x00007ffda6350000 - 0x00007ffda6619000 C:\WINDOWS\System32\KERNELBASE.dll
      0x00007ffda67d0000 - 0x00007ffda68d0000 C:\WINDOWS\System32\ucrtbase.dll
      0x00007ffd7f0f0000 - 0x00007ffd7f109000 C:\Program Files\Java\ojdk-16ea36\bin\VCRUNTIME140.dll
      0x00007ffd88620000 - 0x00007ffd88638000 C:\Program Files\Java\ojdk-16ea36\bin\jli.dll
      0x00007ffda8750000 - 0x00007ffda88f0000 C:\WINDOWS\System32\USER32.dll
      0x00007ffda6320000 - 0x00007ffda6342000 C:\WINDOWS\System32\win32u.dll
      0x00007ffd89760000 - 0x00007ffd899fa000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.844_none_ca00b6081b84eb1d\COMCTL32.dll
      0x00007ffda69d0000 - 0x00007ffda69fa000 C:\WINDOWS\System32\GDI32.dll
      0x00007ffda6210000 - 0x00007ffda631b000 C:\WINDOWS\System32\gdi32full.dll
      0x00007ffda7a50000 - 0x00007ffda7aee000 C:\WINDOWS\System32\msvcrt.dll
      0x00007ffda68d0000 - 0x00007ffda696d000 C:\WINDOWS\System32\msvcp_win.dll
      0x00007ffda8900000 - 0x00007ffda8930000 C:\WINDOWS\System32\IMM32.DLL
      0x00007ffda14d0000 - 0x00007ffda14dc000 C:\Program Files\Java\ojdk-16ea36\bin\vcruntime140_1.dll
      0x00007ffd70fa0000 - 0x00007ffd71031000 C:\Program Files\Java\ojdk-16ea36\bin\msvcp140.dll
      0x00007ffd3a210000 - 0x00007ffd3adbb000 C:\Program Files\Java\ojdk-16ea36\bin\server\jvm.dll
      0x00007ffda6b90000 - 0x00007ffda6c3c000 C:\WINDOWS\System32\ADVAPI32.dll
      0x00007ffda7cb0000 - 0x00007ffda7d4c000 C:\WINDOWS\System32\sechost.dll
      0x00007ffda6a00000 - 0x00007ffda6b2b000 C:\WINDOWS\System32\RPCRT4.dll
      0x00007ffda88f0000 - 0x00007ffda88f8000 C:\WINDOWS\System32\PSAPI.DLL
      0x00007ffd9c5c0000 - 0x00007ffd9c5e7000 C:\WINDOWS\SYSTEM32\WINMM.dll
      0x00007ffda27f0000 - 0x00007ffda27f9000 C:\WINDOWS\SYSTEM32\WSOCK32.dll
      0x00007ffd9f1b0000 - 0x00007ffd9f1ba000 C:\WINDOWS\SYSTEM32\VERSION.dll
      0x00007ffda79e0000 - 0x00007ffda7a4b000 C:\WINDOWS\System32\WS2_32.dll
      0x00007ffda4950000 - 0x00007ffda4962000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll
      0x00007ffda0d00000 - 0x00007ffda0d0a000 C:\Program Files\Java\ojdk-16ea36\bin\jimage.dll
      0x00007ffda3d10000 - 0x00007ffda3ef4000 C:\WINDOWS\SYSTEM32\DBGHELP.DLL
      0x00007ffd9a2f0000 - 0x00007ffd9a31c000 C:\WINDOWS\SYSTEM32\dbgcore.DLL
      0x00007ffda60b0000 - 0x00007ffda6130000 C:\WINDOWS\System32\bcryptPrimitives.dll
      0x00007ffd7a3b0000 - 0x00007ffd7a3d5000 C:\Program Files\Java\ojdk-16ea36\bin\java.dll

      dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
      symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Program Files\Java\ojdk-16ea36\bin;C:\WINDOWS\SYSTEM32;C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.844_none_ca00b6081b84eb1d;C:\Program Files\Java\ojdk-16ea36\bin\server

      VM Arguments:
      jvm_args: -XX:+UseLargePages -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:-UsePerfData -XX:-IgnoreUnrecognizedVMOptions -XX:LargePageSizeInBytes=4m -XX:+OptimizeStringConcat -XX:+UseNUMA -Xmn2g -Xms4g -Xmx4g -Dfile.encoding=UTF-8 --module-path=E:\Profile\eclipse\jdk11\testjmh\target\classes;C:\Users\Stefa\.m2\repository\org\openjdk\jmh\jmh-core\1.23\jmh-core-1.23.jar -Djdk.module.main=testjmh -XX:CompileCommandFile=C:\Users\Stefa\AppData\Local\Temp\jmh885832583825827886compilecommand
      java_command: org.openjdk.jmh.runner.ForkedMain 127.0.0.1 53197
      java_class_path (initial): C:\Users\Stefa\.m2\repository\net\sf\jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar;C:\Users\Stefa\.m2\repository\org\apache\commons\commons-math3\3.2\commons-math3-3.2.jar;C:\Users\Stefa\.m2\repository\org\openjdk\jmh\jmh-generator-annprocess\1.23\jmh-generator-annprocess-1.23.jar
      Launcher Type: SUN_STANDARD

      [Global flags]
           intx CICompilerCount = 4 {product} {ergonomic}
          ccstr CompileCommandFile = C:\Users\Stefa\AppData\Local\Temp\jmh885832583825827886compilecommand {product} {command line}
           uint ConcGCThreads = 3 {product} {ergonomic}
           uint G1ConcRefinementThreads = 10 {product} {ergonomic}
         size_t G1HeapRegionSize = 2097152 {product} {ergonomic}
          uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
           bool IgnoreUnrecognizedVMOptions = false {product} {command line}
         size_t InitialHeapSize = 4294967296 {product} {command line}
         size_t LargePageSizeInBytes = 4194304 {product} {command line}
         size_t MarkStackSize = 4194304 {product} {ergonomic}
         size_t MaxHeapSize = 4294967296 {product} {command line}
         size_t MaxNewSize = 2147483648 {product} {command line}
         size_t MinHeapDeltaBytes = 2097152 {product} {ergonomic}
         size_t MinHeapSize = 4294967296 {product} {command line}
         size_t NewSize = 2147483648 {product} {command line}
          uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic}
          uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
           bool OptimizeStringConcat = true {C2 product} {command line}
          uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
          uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic}
           bool SegmentedCodeCache = true {product} {ergonomic}
         size_t SoftMaxHeapSize = 4294967296 {manageable} {ergonomic}
           bool UnlockExperimentalVMOptions = true {experimental} {command line}
           bool UseAOT = false {experimental} {ergonomic}
           bool UseCompressedClassPointers = true {product lp64_product} {ergonomic}
           bool UseCompressedOops = true {product lp64_product} {ergonomic}
           bool UseFastUnorderedTimeStamps = true {experimental} {ergonomic}
           bool UseG1GC = true {product} {command line}
           bool UseLargePages = true {pd product} {command line}
           bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic}
           bool UseNUMA = false {product} {command line}
           bool UsePerfData = false {product} {command line}

      Logging:
      Log output configuration:
       #0: stdout all=warning uptime,level,tags
       #1: stderr all=off uptime,level,tags

      Environment Variables:
      PATH=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\SourceGear\Common\DiffMerge\;C:\Program Files (x86)\Smart Projects\IsoBuster;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk-15.0.1\bin;;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\Stefa\AppData\Local\Microsoft\WindowsApps;C:\Users\Stefa\AppData\Local\Polycom\RealPresence Desktop\
      USERNAME=Stefa
      OS=Windows_NT
      PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 10, GenuineIntel



      --------------- S Y S T E M ---------------

      OS:
       Windows 10 , 64 bit Build 19041 (10.0.19041.804)
      OS uptime: 0 days 20:29 hours
      Hyper-V role detected

      CPU: total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 158 stepping 10 microcode 0xca, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, rtm, adx, fma, vzeroupper, clflush, clflushopt, hv

      Memory: 4k page, system-wide physical 65468M (44111M free)
      TotalPageFile size 131004M (AvailPageFile size 107996M)
      current process WorkingSet (physical memory assigned to process): 10M, peak: 10M
      current process commit charge ("private bytes"): 4357M, peak: 4357M

      vm_info: OpenJDK 64-Bit Server VM (16+36-2231) for windows-amd64 JRE (16+36-2231), built on Feb 8 2021 11:39:36 by "mach5one" with MS VC++ 16.7 (VS2019)

      END.


      ---------- BEGIN SOURCE ----------
      package de.sph.testjmh;

      import java.nio.charset.StandardCharsets;
      import java.util.Random;

      import org.openjdk.jmh.annotations.Benchmark;
      import org.openjdk.jmh.annotations.Mode;
      import org.openjdk.jmh.annotations.Scope;
      import org.openjdk.jmh.annotations.State;
      import org.openjdk.jmh.infra.Blackhole;
      import org.openjdk.jmh.runner.Runner;
      import org.openjdk.jmh.runner.options.Options;
      import org.openjdk.jmh.runner.options.OptionsBuilder;


      public class Main {

      @Benchmark
      public void testCreateStringIntern(final Blackhole blackhole, final BenchmarkState state) {
      final byte[] ba = new byte[2];
      ba[0] = (byte) state.rand.nextInt(256);
      ba[1] = (byte) state.rand.nextInt(256);
      blackhole.consume(new String(ba, StandardCharsets.UTF_8).intern());
      }

      @Benchmark
      public void testCreateStringWithoutIntern(final Blackhole blackhole, final BenchmarkState state) {
      final byte[] ba = new byte[2];
      ba[0] = (byte) state.rand.nextInt(256);
      ba[1] = (byte) state.rand.nextInt(256);
      blackhole.consume(new String(ba, StandardCharsets.UTF_8));
      }

      @State(Scope.Benchmark)
      public static class BenchmarkState {

      public Random rand = new Random(1);
      }

      public static void main(String... args) throws Exception {

      Options opts = new OptionsBuilder().include(Main.class.getSimpleName())
      .warmupIterations(5)
      .measurementIterations(10)
      .mode(Mode.Throughput)
      .shouldDoGC(true)
      //.addProfiler(StackProfiler.class)
      .forks(1)
      .build();

      new Runner(opts).run();
      }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Compiling it with jdk 15.0.1 -> everything is fine.

      FREQUENCY : often


        Attachments

          Activity

            People

            Assignee:
            sswsharm swati sharma
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: