RFR: 8255908: ExceptionInInitializerError due to UncheckedIOException while initializing cgroupv1 subsystem [v2]
Aleksey Shipilev
shade at openjdk.java.net
Thu Nov 19 18:00:16 UTC 2020
On Thu, 19 Nov 2020 15:00:54 GMT, Poonam Bajaj <poonam at openjdk.org> wrote:
>> src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1Subsystem.java line 79:
>>
>>> 77: .forEach(entry -> createSubSystemController(subsystem, entry));
>>> 78:
>>> 79: } catch (UncheckedIOException e) {
>>
>> I am confused. `CgroupUtil.readFilePrivileged` unwraps `UncheckedIOException`, why this catch clause is needed? Is this because the cause might be `UncheckedIOException` itself? Might be easier to rewrap `UncheckedIOException` to just `IOException` in `CgroupUtil`.
>
> It is there to catch the UncheckedIOException that could get thrown while processing each line and entry. Example of this exception encountered with JDK 8u.
>
> 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)... 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)
Got it, thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1303
More information about the core-libs-dev
mailing list