From d9fa9353aa321c8b77bcdd6dcd350d1f13bc83d5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 13 Jan 2026 16:33:39 +0000 Subject: [PATCH] Prevent VirtualThreadSchedulerMXBean problems from breaking /info At the time of writing, VirtualThreadSchedulerMXBean does not work in a GraalVM native image (oracle/graal#12802). An attempt to retrieve the MXBean results in an IllegalArgumentException being thrown. This causes a failure when serializing ProcessInfo to JSON, breaking the Actuator's info endpoint when management.info.process.enabled=true. This commit updates ProcessInfo to be more defensive when working with the MXBean. Now, if any exception is thrown, null will be returned for the virtual threads info. This approach should allow the functionality to work whenever a fix is made in Graal without requiring further changes in Boot. Fixes gh-48810 --- .../main/java/org/springframework/boot/info/ProcessInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/ProcessInfo.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/ProcessInfo.java index b8fa1d8e459..9400e7ae87c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/ProcessInfo.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/ProcessInfo.java @@ -108,7 +108,7 @@ public class ProcessInfo { int poolSize = invokeMethod(mxbeanClass, mxbean, "getPoolSize"); return new VirtualThreadsInfo(mountedVirtualThreadCount, queuedVirtualThreadCount, parallelism, poolSize); } - catch (ReflectiveOperationException ex) { + catch (Exception ex) { return null; } }