mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 20:19:06 +00:00
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
This commit is contained in:
+1
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user