RFR: 8255908: ExceptionInInitializerError due to UncheckedIOException while initializing cgroupv1 subsystem

Aleksey Shipilev shade at openjdk.java.net
Thu Nov 19 14:40:04 UTC 2020


On Thu, 19 Nov 2020 01:22:01 GMT, Poonam Bajaj <poonam at openjdk.org> wrote:

> Hi,
> 
> Please review this simple change that catches UncheckedIOException that can occur if /proc/self/cgroup or /proc/self/mountinfo files don't exist on the system, or if there is an interrupt while these are being read.
> 
> Testing: Tier1, Tier2 and Tier3.
> 
> Thanks,
> Poonam

Changes requested by shade (Reviewer).

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`.

src/java.base/linux/classes/jdk/internal/platform/CgroupUtil.java line 50:

> 48:             throw new InternalError(e.getCause());
> 49:         } catch (UncheckedIOException e) {
> 50:             throw e.getCause();

There are other reader methods in the same file, should this block be added to them as well?

-------------

PR: https://git.openjdk.java.net/jdk/pull/1303


More information about the core-libs-dev mailing list