JDK-8371081 : Async exception can be installed and cleared in Deoptimization::uncommon_trap_inner
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 25
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-10-31
  • Updated: 2025-11-03
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 26
26Unresolved
Related Reports
Relates :  
Description
If an uncommon trap happens because a klass is not loaded yet, we will try to load it by calling `Deoptimization::load_class_by_index`. If there is an exception thrown while trying to load the class we clear it, relying on the fact that it will be thrown again once we are back in the interpreter to re-execute the bytecode. The exception is cleared using CLEAR_PENDING_NONASYNC_EXCEPTION, which is implemented as:

if ((_pending_exception->klass() != vmClasses::InternalError_klass() ||
       java_lang_InternalError::during_unsafe_access(_pending_exception) != JNI_TRUE)) {
    clear_pending_exception();
  }

This means we only consider as an async exception an InternalError in accesses through the Unsafe class, which is incorrect. For JVMTI StopThread, any exception could be sent as an async exception. Also for ScopedMemoryAccess we use asynchronous exceptions of type ScopedAccessError.