JDK-8255908 : ExceptionInInitializerError due to UncheckedIOException while initializing cgroupv1 subsystem
  • Type: Bug
  • Component: core-libs
  • Affected Version: 8u261
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • Submitted: 2020-11-04
  • Updated: 2024-07-05
  • Resolved: 2020-11-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 15 JDK 16 JDK 8 Other
11.0.10-oracleFixed 13.0.6Fixed 15.0.4Fixed 16 b26Fixed 8u271Fixed openjdk8u292Fixed
Related Reports
Duplicate :  
Description
jdk.internal.platform.cgroupv1.Metrics.initContainerSubSystems() can fail with the following exception if the system does not have /proc/self/cgroup or /proc/self/mountinfo files.

java.lang.ExceptionInInitializerError
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at jdk.internal.platform.Metrics.systemMetrics(Metrics.java:59)
	at jdk.internal.platform.Container.metrics(Container.java:42)
	at sun.management.OperatingSystemImpl.<init>(OperatingSystemImpl.java:46) at sun.management.ManagementFactoryHelper.getOperatingSystemMXBean(ManagementFactoryHelper.java:106) at java.lang.management.PlatformComponent$7.getMXBeans(PlatformComponent.java:157)	at java.lang.management.PlatformComponent.getMXBeans(PlatformComponent.java:377)	at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:472)
...
Comments
Fix request (15u) Requesting backport to 15u for parity with 11u. The patch applies cleanly. Tested with tier1 and container tests.
17-05-2021

Fix request (13u) Requesting backport to 13u for parity with 11u. The patch doesn't apply cleanly since 13u doesn't have cgroups v2 support (JDK-8231111), so it reapplied manually to similar places in cgroupv1/Metrics.java and cgroupv1/SubSystem.java. Tested with tier1 and container tests. RFR: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2021-January/004713.html
22-01-2021

Fix Request (OpenJDK 8u): Please approve this change for 8u. I see Oracle backported it too. The JDK 11 patch didn't apply cleanly, but was trivially resolved. Reviewed by Andrew Haley. Risk should be low as it only adds some more error checking. RFR: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2020-December/013261.html webrev: https://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8255908/jdk8/02/webrev/
23-12-2020

[~goetz] FWIW, I haven't added the JDK 11 fix request tag, because the patch still needs a review. If you want to review it, it would be appreciated.
22-12-2020

I'm working on OpenJDK 8u and 11u backports of this. 11u webrev: https://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8255908/01/webrev/ RFR: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-December/004385.html
10-12-2020

Yes, it was specific to Oracle JDK 8
02-12-2020

[~wyandi] I can only assume your previous comment refers to Oracle JDK 8 (or some such), because it doesn't make any sense in the context of OpenJDK. JDK-8250627 certainly didn't introduce Metrics.java/SubSystem.java. JDK-8203357 did (for OpenJDK)!
02-12-2020

Changeset: 8d9cf48e Author: Poonam Bajaj <poonam@openjdk.org> Date: 2020-11-20 18:40:01 +0000 URL: https://github.com/openjdk/jdk/commit/8d9cf48e
20-11-2020

The exception is caused by: Caused by: java.io.UncheckedIOException: java.nio.channels.ClosedByInterruptException at java.io.BufferedReader$1.hasNext(BufferedReader.java:574) at java.util.Iterator.forEachRemaining(Iterator.java:115) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at jdk.internal.platform.cgroupv1.Metrics.initContainerSubSystems(Metrics.java:81) at jdk.internal.platform.cgroupv1.Metrics.<clinit>(Metrics.java:51)\n\t... 41 more Caused by: java.nio.channels.ClosedByInterruptException at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202) at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:164) at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65) at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109) at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:161) at java.io.BufferedReader.readLine(BufferedReader.java:324) at java.io.BufferedReader.readLine(BufferedReader.java:389) at java.io.BufferedReader$1.hasNext(BufferedReader.java:571)
17-11-2020