Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ThreadDumpEndpoint to call ThreadMXBean in a native image #31680

Closed
mhalbritter opened this issue Jul 12, 2022 · 2 comments
Closed

Allow ThreadDumpEndpoint to call ThreadMXBean in a native image #31680

mhalbritter opened this issue Jul 12, 2022 · 2 comments
Assignees
Labels
theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@mhalbritter
Copy link
Contributor

mhalbritter commented Jul 12, 2022

At the moment, the ThreadDumpEndpoint is not usable in a native image, as GraalVM doesn't implement thread dumping yet.

I've opened an issue for that: oracle/graal#4714

When that issue is resolved, remove the

if (NativeDetector.inNativeImage()) {
  throw new ThreadDumperUnavailableException("Running in native image");
}

condition.

@mhalbritter mhalbritter added type: enhancement A general enhancement status: blocked An issue that's blocked on an external project change labels Jul 12, 2022
@mhalbritter mhalbritter added this to the 3.0.x milestone Jul 12, 2022
@mhalbritter mhalbritter added the theme: aot An issue related to Ahead-of-time processing label Jul 12, 2022
@wilkinsona
Copy link
Member

We're going to remove the condition now so that the fix is available to users as soon as it has been fixed in Graal.

@wilkinsona wilkinsona removed the status: blocked An issue that's blocked on an external project change label Oct 4, 2022
@wilkinsona
Copy link
Member

With the condition removed, a client will receive a 500 response:

HTTP/1.1 500 
Connection: close
Content-Type: application/json
Date: Tue, 04 Oct 2022 15:53:34 GMT
Transfer-Encoding: chunked

{
    "error": "Internal Server Error",
    "path": "/actuator/threaddump",
    "status": 500,
    "timestamp": "2022-10-04T15:53:34.629+00:00"
}

And the server will log an UnsupportedFeatureError:

com.oracle.svm.core.jdk.UnsupportedFeatureError: ThreadMXBean methods
	at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89) ~[na:na]
	at com.oracle.svm.core.jdk.management.SubstrateThreadMXBean.dumpAllThreads(SubstrateThreadMXBean.java:241) ~[na:na]
	at org.springframework.boot.actuate.management.ThreadDumpEndpoint.getFormattedThreadDump(ThreadDumpEndpoint.java:51) ~[actuator-webmvc:3.0.0-SNAPSHOT]
	at org.springframework.boot.actuate.management.ThreadDumpEndpoint.threadDump(ThreadDumpEndpoint.java:42) ~[actuator-webmvc:3.0.0-SNAPSHOT]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[actuator-webmvc:na]
	at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:281) ~[na:na]
	at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:74) ~[na:na]
	at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:60) ~[actuator-webmvc:3.0.0-SNAPSHOT]
	…

oracle/graal#4714 is tracking removing the limitation from Graal. Until the Graal issue has been fixed, anyone encountering this problem may want to add 👍 reaction to the issue's opening comment. Once it has been fixed, anyone encountering the problem should check that they are using a version of Graal that contains the fix.

@wilkinsona wilkinsona self-assigned this Oct 4, 2022
@wilkinsona wilkinsona changed the title Enable ThreadDumpEndpoint on native-image Allow ThreadDumpEndpoint to call ThreadMXBean in a native-image Oct 4, 2022
@wilkinsona wilkinsona changed the title Allow ThreadDumpEndpoint to call ThreadMXBean in a native-image Allow ThreadDumpEndpoint to call ThreadMXBean in a native image Oct 4, 2022
@wilkinsona wilkinsona modified the milestones: 3.0.x, 3.0.0-RC1 Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants