Bug 263881 - java/openjdk17-jre Exception: Thread CPU time measurement is not supported
Summary: java/openjdk17-jre Exception: Thread CPU time measurement is not supported
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-java (Nobody)
Depends on:
Reported: 2022-05-09 14:48 UTC by indgy
Modified: 2022-05-10 12:14 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (java)


Note You need to log in before you can comment on or make changes to this bug.
Description indgy 2022-05-09 14:48:42 UTC
Using OpenJDK17-JRE with GoCD Server (Zip version) from here:

GoCD is a CI/CD server.

GoCD Server fails to run correctly when running a job in a Pipeline.

Downgrading to OpenJDK11-JRE fixes the issue, the above error no longer appears.

The following error seems to be the culprit.

java.lang.UnsupportedOperationException: Thread CPU time measurement is not supported.
	at java.management/sun.management.ThreadImpl.verifyThreadCpuTime(Unknown Source)
	at java.management/sun.management.ThreadImpl.getThreadCpuTime(Unknown Source)
	at jdk.management/com.sun.management.internal.HotSpotThreadImpl.getThreadCpuTime(Unknown Source)
	at java.management/sun.management.ThreadImpl.getThreadCpuTime(Unknown Source)
	at com.thoughtworks.go.server.service.support.DaemonThreadStatsCollector.captureStats(DaemonThreadStatsCollector.java:33)
	at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:82)
	at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:63)
	at java.base/java.lang.Thread.run(Unknown Source)

Please drop me an email if you want me to setup an reproducable example.

Thank you
Comment 1 indgy 2022-05-09 19:37:20 UTC
As suggested on the Discord chat by Genesys the issue may be related to this:


Using OpenJDK16 the issue does not occur and the app works as expected.
Comment 2 indgy 2022-05-10 12:14:20 UTC
@genesys also provided minimal code too reproduce, this works in v16 but fails under v17

echo "
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
ThreadMXBean tb = ManagementFactory.getThreadMXBean();
System.out.println(tb.getThreadCpuTime(Thread.currentThread().getId())); " | JAVA_VERSION=17 jshell -