Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Exception raised when calling java.lang.Runtime.availableProcessors with native image #4757

@hamsongliu

Description

@hamsongliu

Describe the issue
Caused by: java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:208)
at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:263)
at java.nio.file.Path.of(Path.java:147)
at java.nio.file.Paths.get(Paths.java:69)
at com.oracle.svm.core.containers.CgroupUtil.lambda$readStringValue$0(CgroupUtil.java:57)
at java.security.AccessController.executePrivileged(AccessController.java:145)
at java.security.AccessController.doPrivileged(AccessController.java:569)
at com.oracle.svm.core.containers.CgroupUtil.readStringValue(CgroupUtil.java:59)
at com.oracle.svm.core.containers.CgroupSubsystemController.getStringValue(CgroupSubsystemController.java:66)
at com.oracle.svm.core.containers.CgroupSubsystemController.getLongValue(CgroupSubsystemController.java:125)
at com.oracle.svm.core.containers.cgroupv1.CgroupV1Subsystem.getLongValue(CgroupV1Subsystem.java:269)
at com.oracle.svm.core.containers.cgroupv1.CgroupV1Subsystem.getCpuQuota(CgroupV1Subsystem.java:321)
at com.oracle.svm.core.containers.CgroupMetrics.getCpuQuota(CgroupMetrics.java:71)
at com.oracle.svm.core.ContainerInfo.getCpuQuota(ContainerInfo.java:41)
at com.oracle.svm.core.Containers.activeProcessorCount(Containers.java:127)
at java.lang.Runtime.availableProcessors(Runtime.java:241)

Steps to reproduce the issue
Create a native image which invokes "java.lang.Runtime.availableProcessors"

Describe GraalVM and your environment:

  • openjdk version "17.0.3" 2022-04-19
  • OpenJDK Runtime Environment GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06)
  • OpenJDK 64-Bit Server VM GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06, mixed mode, sharing)
  • OS: GNU/Linux
  • Architecture: x86_64

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions