JDK-8334564 : VM startup: fatal error: FLAG_SET_ERGO cannot be used to set an invalid value for NonNMethodCodeHeapSize
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 23,24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2024-06-19
  • Updated: 2024-09-25
  • Resolved: 2024-06-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23 JDK 24
23.0.2Fixed 24 b04Fixed
Related Reports
Relates :  
Description
On linuxppc64le, we run into this error on some machines :
"fatal error: FLAG_SET_ERGO cannot be used to set an invalid value for NonNMethodCodeHeapSize"
In stderr we see the output :  stderr: [uintx NonNMethodCodeHeapSize=0 is outside the allowed range [ 65536 ... 18446744073709551615 ]

stack is below :
#  Internal Error (jvmFlagAccess.cpp:71), pid=60589, tid=60596
#  fatal error: FLAG_SET_ERGO cannot be used to set an invalid value for NonNMethodCodeHeapSize
#
# JRE version:  (24.0) (build )
# Java VM: OpenJDK 64-Bit Server VM (24-internal-adhoc.jenkinsi.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-ppc64le)
# Problematic frame:
# V  [libjvm.so+0xab8b0c]  TypedFlagAccessImpl<bool, EventBooleanFlagChanged>::check_constraint_and_set(JVMFlag*, void*, JVMFlagOrigin, bool) const [clone .part.0]+0x4c
#
 
Host: POWER9 (architected), altivec supported, 64 cores, 61G, Red Hat Enterprise Linux release 9.3 (Plow)
Time: Mon Jun 17 22:05:06 2024 CEST elapsed time: 0.006976 seconds (0d 0h 0m 0s)
 
---------------  T H R E A D  ---------------
 
Current thread (0x00007fff8c02eb90):  JavaThread "Unknown thread" [_thread_in_vm, id=60596, stack(0x00007fff92ff0000,0x00007fff931f0000) (2048K)]
 
Stack: [0x00007fff92ff0000,0x00007fff931f0000],  sp=0x00007fff931eda70,  free space=2038k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xab8b0c]  TypedFlagAccessImpl<bool, EventBooleanFlagChanged>::check_constraint_and_set(JVMFlag*, void*, JVMFlagOrigin, bool) const [clone .part.0]+0x4c  (jvmFlagAccess.cpp:71)
V  [libjvm.so+0xabfe38]  RangedFlagAccessImpl<unsigned long, EventUnsignedLongFlagChanged>::set_impl(JVMFlag*, void*, JVMFlagOrigin) const+0x1c68  (jfrEncoders.hpp:236)
V  [libjvm.so+0xaba430]  JVMFlagAccess::set_or_assert(JVMFlagsEnum, int, void*, JVMFlagOrigin)+0xb0  (jvmFlagAccess.cpp:49)
V  [libjvm.so+0x5fdb5c]  CodeCache::initialize_heaps()+0x4dc  (jvmFlagAccess.hpp:100)
V  [libjvm.so+0x5fe0fc]  CodeCache::initialize()+0x6c  (codeCache.cpp:1118)
V  [libjvm.so+0x920188]  init_globals()+0x78  (init.cpp:125)
V  [libjvm.so+0x10a9b40]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x350  (threads.cpp:550)
V  [libjvm.so+0xa5134c]  JNI_CreateJavaVM+0x9c  (jni.cpp:3581)
C  [libjli.so+0x7374]  JavaMain+0xd4  (java.c:1592)
C  [libjli.so+0xcbd8]  ThreadJavaMain+0x18  (java_md.c:653)
C  [libc.so.6+0xb0044]  start_thread+0x184
 
The issue is triggered when running  HS :tier1 , e.g.  test runtime/os/TestTracePageSizes.java#G1 .

This issue might be related to certain page size features available on the machine.
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk23u/pull/34 Date: 2024-07-25 11:33:07 +0000
25-07-2024

Changeset: 2e64d151 Author: Lutz Schmidt <lucy@openjdk.org> Date: 2024-06-24 11:27:18 +0000 URL: https://git.openjdk.org/jdk/commit/2e64d15144be03388104c762816c1ba629da9639
24-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19812 Date: 2024-06-20 15:54:29 +0000
20-06-2024

This failure is platform independent. It only depends on the huge page size. Easy reproducer (at least on linuxppc64le): jdk/bin/java -XX:+UseShenandoahGC -XX:+UseTransparentHugePages -version
20-06-2024

The test runs with 16M page size. During code heap segment size ergo processing, the segment sizes are rounded down to min_size which is a multiple of the page size. Unfortunately, the non_nmethod size evaluates to some value smaller than min_size, resulting into size zero after round_down. I'm working on modifying the size allocations.
19-06-2024

The machine showing these issues has (info from hserr) : Hugepagesize: 16384 kB Hugetlb: 0 kB /sys/kernel/mm/transparent_hugepage/enabled: always [madvise] never /sys/kernel/mm/transparent_hugepage/hpage_pmd_size: 16777216 …. Page Sizes: 64k, 16M
19-06-2024