diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jvmstat/PerfManager.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jvmstat/PerfManager.java index 93795fa4c3cf..6d4d1e52f45b 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jvmstat/PerfManager.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jvmstat/PerfManager.java @@ -44,6 +44,7 @@ import com.oracle.svm.core.locks.VMMutex; import com.oracle.svm.core.option.HostedOptionKey; import com.oracle.svm.core.option.RuntimeOptionKey; +import com.oracle.svm.core.thread.RecurringCallbackSupport; import com.oracle.svm.core.util.VMError; import jdk.graal.compiler.options.Option; @@ -184,8 +185,9 @@ private static class PerfDataThread extends Thread { @Override public void run() { - initializeMemory(); + RecurringCallbackSupport.suspendCallbackTimer("Performance data thread must not execute recurring callbacks."); + initializeMemory(); try { sampleData(); ImageSingletons.lookup(PerfMemory.class).setAccessible(); @@ -213,8 +215,11 @@ private void initializeMemory() { initialized = true; initializationCondition.broadcast(); + } catch (OutOfMemoryError e) { + /* For now, we can only rethrow the error to terminate the thread (see GR-40601). */ + throw e; } catch (Throwable e) { - VMError.shouldNotReachHere(ERROR_DURING_INITIALIZATION, e); + throw VMError.shouldNotReachHere(ERROR_DURING_INITIALIZATION, e); } finally { initializationMutex.unlock(); }