RFR(T): 8229925: [s390] Exception check missing in interpreter
martin.doerr at sap.com
Thu Aug 22 14:59:13 UTC 2019
Hi David and Richard,
thanks for the reviews. I've pushed it.
Nevertheless, I think it was worth looking into InterpreterRuntime::build_method_counters which may not work as expected.
Consider the following scenario:
- JVMTI thread calls JvmtiEnv::StopThread to install an asynchronous exception into thread T1.
- VM Thread initiates a safepoint when executing the VM operation VM_ThreadStop (mode _async_safepoint).
- Thread T1 is executing InterpreterRuntime::build_method_counters and attempts to acquire Heap_lock (in satisfy_failed_metadata_allocation) which checks for safepoint.
- VM Thread installs _pending_async_exception into T1 at safepoint.
- Thread T1 converts it to a _pending_exception (check_and_handle_async_exceptions) when the safepoint is over and returns to Method::build_method_counters.
It misinterprets the exception as a metaspace OOM, clears it and returns NULL!
(Debug build should run into assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");)
I guess I should open a bug for that.
More information about the hotspot-runtime-dev