JDK-8244946 : fatal error: memory leak: allocating without ResourceMark with -XX:+Verbose -Xlog:methodhandles
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 14,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-05-13
  • Updated: 2024-09-28
  • Resolved: 2020-05-25
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 15
15 b25Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/resourceArea.inline.hpp:33
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/christian/jdk/open/src/hotspot/share/memory/resourceArea.inline.hpp:33), pid=7995, tid=7996
#  fatal error: memory leak: allocating without ResourceMark
#
# JRE version: Java(TM) SE Runtime Environment (15.0) (slowdebug build 15-internal+0-2020-04-22-0733482.christian...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 15-internal+0-2020-04-22-0733482.christian..., mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xf2730d]  ResourceArea::allocate_bytes(unsigned long, AllocFailStrategy::AllocFailEnum)+0x51
#

Reproduce: java -XX:+Verbose -Xlog:methodhandles Empty.java

Where Empty.java just contains an empty main() method.

Here's the crashing thread's stack trace:

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

Current thread (0x00007f9520033800):  JavaThread "main" [_thread_in_Java, id=21051, stack(0x00007f9527175000,0x00007f9527276000)]

Stack: [0x00007f9527175000,0x00007f9527276000],  sp=0x00007f9527273400,  free space=1017k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xf2730d]  ResourceArea::allocate_bytes(unsigned long, AllocFailStrategy::AllocFailEnum)+0x51
V  [libjvm.so+0xf3a85e]  resource_allocate_bytes(unsigned long, AllocFailStrategy::AllocFailEnum)+0x31
V  [libjvm.so+0x10040ec]  Symbol::as_C_string() const+0x30
V  [libjvm.so+0x10043b6]  Symbol::as_klass_external_name() const+0x18
V  [libjvm.so+0xc7b522]  Klass::external_name() const+0x268
V  [libjvm.so+0x9990a8]  InstanceKlass::internal_name() const+0x18
V  [libjvm.so+0xc7b797]  Klass::oop_print_on(oopDesc*, outputStream*)+0x2b
V  [libjvm.so+0x99899b]  InstanceKlass::oop_print_on(oopDesc*, outputStream*)+0x2b
V  [libjvm.so+0xe4e8a4]  oopDesc::print_on(outputStream*) const+0x3a
V  [libjvm.so+0xe4e907]  oopDesc::print()+0x25
V  [libjvm.so+0xdf1faf]  trace_method_handle_stub(char const*, oopDesc*, long*, long*)+0x4ed
V  [libjvm.so+0xdf2027]  trace_method_handle_stub_wrapper(MethodHandleStubArguments*)+0x33
v  ~BufferBlob::MethodHandles adapters
j  java.lang.invoke.LambdaForm$MH+0x0000000800060c40.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+28 java.base
j  java.lang.invoke.BootstrapMethodInvoker.invoke(Ljava/lang/Class;Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;+262 java.base
j  java.lang.invoke.CallSite.makeSite(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/invoke/CallSite;+8 java.base
j  java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(Ljava/lang/Class;Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/invoke/MemberName;+6 java.base
j  java.lang.invoke.MethodHandleNatives.linkCallSite(Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/invoke/MemberName;+46 java.base
v  ~StubRoutines::call_stub
V  [libjvm.so+0x9c05e8]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x5da
V  [libjvm.so+0xe7cefe]  os::os_exception_wrapper(void (*)(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*), JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x36
V  [libjvm.so+0x9c000a]  JavaCalls::call(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x8e
V  [libjvm.so+0x9bf8c7]  JavaCalls::call_static(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x13d
V  [libjvm.so+0x101e886]  SystemDictionary::invoke_bootstrap_method(BootstrapInfo&, Thread*)+0x346
V  [libjvm.so+0xcb3272]  LinkResolver::resolve_dynamic_call(CallInfo&, BootstrapInfo&, Thread*)+0x28
V  [libjvm.so+0xcb319a]  LinkResolver::resolve_invokedynamic(CallInfo&, constantPoolHandle const&, int, Thread*)+0x10c
V  [libjvm.so+0xcb27b6]  LinkResolver::resolve_invoke(CallInfo&, Handle, constantPoolHandle const&, int, Bytecodes::Code, Thread*)+0x158
V  [libjvm.so+0x9b5a75]  InterpreterRuntime::resolve_invokedynamic(JavaThread*)+0xf5
V  [libjvm.so+0x9b5cb6]  InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x182
j  jdk.internal.module.SystemModuleFinders$1.find(Ljava/lang/String;)Ljava/util/Optional;+5 java.base
j  jdk.internal.module.ModuleBootstrap.boot()Ljava/lang/ModuleLayer;+295 java.base
j  java.lang.System.initPhase2(ZZ)I+0 java.base
v  ~StubRoutines::call_stub
V  [libjvm.so+0x9c05e8]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x5da
V  [libjvm.so+0xe7cefe]  os::os_exception_wrapper(void (*)(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*), JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x36
V  [libjvm.so+0x9c000a]  JavaCalls::call(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x8e
V  [libjvm.so+0x9bf8c7]  JavaCalls::call_static(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x13d
V  [libjvm.so+0x1063a72]  call_initPhase2(Thread*)+0xfc
V  [libjvm.so+0x106494a]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x790
V  [libjvm.so+0xa8b69f]  JNI_CreateJavaVM_inner(JavaVM_**, void**, void*)+0xda
V  [libjvm.so+0xa8b996]  JNI_CreateJavaVM+0x32
C  [libjli.so+0x76f2]  InitializeJVM+0x13e
C  [libjli.so+0x42cd]  JavaMain+0xd7
C  [libjli.so+0xbdb9]  ThreadJavaMain+0x27
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/dd322637eaa0 User: chagedorn Date: 2020-05-25 09:36:05 +0000
25-05-2020

ResourceMark was removed from Klass::oop_print_on() in JDK-8222893, in JDK 13. This is missing now in trace_method_handle_stub() when calling oopDesc::print().
13-05-2020