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

com.oracle.svm.core.jdk.UnsupportedFeatureError: ThreadMXBean methods #1039

Closed
ilopmar opened this issue Mar 5, 2019 · 6 comments
Closed
Assignees

Comments

@ilopmar
Copy link

ilopmar commented Mar 5, 2019

To reproduce the issue:

  • git clone https://github.com/micronaut-graal-tests/micronaut-management-graal
  • cd micronaut-management-graal
  • git checkout threadmxbean
  • Use latest GraalVM from master
  • ./build-native-image.sh
  • The image is generated correctly. Start it: ./management-graal
  • curl localhost:8080/metrics/jvm.threads.states

Error:

17:00:48.012 [main] INFO  io.micronaut.runtime.Micronaut - Startup completed in 42ms. Server Running: http://localhost:8080
17:00:49.261 [pool-2-thread-3] ERROR i.m.h.s.netty.RoutingInBoundHandler - Unexpected error occurred: ThreadMXBean methods
com.oracle.svm.core.jdk.UnsupportedFeatureError: ThreadMXBean methods
	at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:102)
	at com.oracle.svm.core.jdk.SubstrateThreadMXBean.getAllThreadIds(JavaManagementSubstitutions.java:416)
	at io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics.getThreadStateCount(JvmThreadMetrics.java:84)
	at io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics.lambda$bindTo$0(JvmThreadMetrics.java:74)
	at io.micrometer.core.instrument.internal.DefaultGauge.value(DefaultGauge.java:40)
	at io.micrometer.core.instrument.Measurement.getValue(Measurement.java:39)
	at io.micronaut.configuration.metrics.management.endpoint.MetricsEndpoint.lambda$mergeMeasurements$5(MetricsEndpoint.java:191)
	at java.util.Collections$SingletonList.forEach(Collections.java:4822)
	at io.micronaut.configuration.metrics.management.endpoint.MetricsEndpoint.mergeMeasurements(MetricsEndpoint.java:190)
	at io.micronaut.configuration.metrics.management.endpoint.MetricsEndpoint.lambda$getSamples$4(MetricsEndpoint.java:185)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at io.micronaut.configuration.metrics.management.endpoint.MetricsEndpoint.getSamples(MetricsEndpoint.java:185)
	at io.micronaut.configuration.metrics.management.endpoint.MetricsEndpoint.getMetricDetailsResponse(MetricsEndpoint.java:157)
	at io.micronaut.configuration.metrics.management.endpoint.MetricsEndpoint.getMetricDetails(MetricsEndpoint.java:113)
	at io.micronaut.configuration.metrics.management.endpoint.$MetricsEndpointDefinition$$exec2.invokeInternal(Unknown Source)
	at io.micronaut.context.AbstractExecutableMethod.invoke(AbstractExecutableMethod.java:144)
	at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:2548)
	at io.micronaut.web.router.AbstractRouteMatch.execute(AbstractRouteMatch.java:295)
	at io.micronaut.web.router.RouteMatch.execute(RouteMatch.java:122)
	at io.micronaut.http.server.netty.RoutingInBoundHandler.lambda$buildResultEmitter$16(RoutingInBoundHandler.java:1307)
	at io.reactivex.internal.operators.flowable.FlowableCreate.subscribeActual(FlowableCreate.java:71)
	at io.reactivex.Flowable.subscribe(Flowable.java:14805)
	at io.reactivex.Flowable.subscribe(Flowable.java:14752)
	at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
	at io.reactivex.Flowable.subscribe(Flowable.java:14805)
	at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)
	at io.reactivex.Flowable.subscribe(Flowable.java:14805)
	at io.reactivex.Flowable.subscribe(Flowable.java:14752)
	at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
	at io.reactivex.Flowable.subscribe(Flowable.java:14805)
	at io.reactivex.internal.operators.flowable.FlowableSwitchIfEmpty.subscribeActual(FlowableSwitchIfEmpty.java:32)
	at io.reactivex.Flowable.subscribe(Flowable.java:14805)
	at io.reactivex.Flowable.subscribe(Flowable.java:14752)
	at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
	at io.reactivex.Flowable.subscribe(Flowable.java:14805)
	at io.reactivex.Flowable.subscribe(Flowable.java:14755)
	at io.micronaut.http.context.ServerRequestTracingPublisher.lambda$subscribe$0(ServerRequestTracingPublisher.java:52)
	at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
	at io.micronaut.http.context.ServerRequestTracingPublisher.subscribe(ServerRequestTracingPublisher.java:52)
	at io.micronaut.configuration.metrics.binder.web.WebMetricsPublisher.subscribe(WebMetricsPublisher.java:122)
	at io.reactivex.internal.operators.flowable.FlowableFromPublisher.subscribeActual(FlowableFromPublisher.java:29)
	at io.reactivex.Flowable.subscribe(Flowable.java:14805)
	at io.reactivex.Flowable.subscribe(Flowable.java:14752)
	at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
	at io.reactivex.Flowable.subscribe(Flowable.java:14805)
	at io.reactivex.Flowable.subscribe(Flowable.java:14752)
	at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
	at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:288)
	at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:253)
	at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:79)
	at io.micrometer.core.instrument.Timer.lambda$wrap$0(Timer.java:143)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:481)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
17:00:49.263 [pool-2-thread-3] DEBUG i.m.c.beans.DefaultBeanIntrospector - Found BeanIntrospection for type: class io.micronaut.http.hateoas.JsonError
@jeevavenkataraman
Copy link

Hello, Any updates on this?

@daddykotex
Copy link

I'm also curious to know if there is an update on this. I'm investigating GraalVM at work and got pretty far but this is a blocker. We use prometheus and their official java-client: https://github.com/prometheus/client_java. It seems to rely on ThreadMXBean because I get a very similar stack trace when I try to run my natively built image.

If there is a way to mitigate this, I'd be a taker. I don't know if it's a configuration issue at native-image build time or if it's a problem with the generation itself.

@shakuzen
Copy link

shakuzen commented Jun 7, 2021

An update from the Micrometer side (since it is used in the original issue report) is that since Micrometer 1.3.7, the error should not be thrown at runtime. The metrics related to thread states will be unavailable but we handle the error since 1.3.7. See micrometer-metrics/micrometer@6635860.

@virusdave
Copy link

Any updates on this?

@virusdave
Copy link

It would at least be nice to not throw an uncatchable runtime error for the unimplemented methods, such as an attempt to get a list of threadids. This should certainly be handleable gracefully by caller if a nonfatal exception were thrown instead.

@cstancu
Copy link
Member

cstancu commented Dec 6, 2023

ThreadMXBean support is tracked by #6101.

@cstancu cstancu closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants