-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
Describe the issue
Current com.oracle.svm.core.containers.cgroupv1.CgroupV1Subsystem only recognizes the fixed patterns of controller list from /proc/self/cgroup. When the controller list contents are changed, it fails to read the controller information and exits. The fix PR is proposed: #6381
Steps to reproduce the issue
Given the following code example.
public class TestGetProcessors {
static public void main(String[] args){
System.out.println("Available processors are " + Runtime.getRuntime().availableProcessors());
}
}My /proc/self/cgroup looks like:
$cat /proc/self/cgroup
10:pids:/system.slice/sshd.service
9:freezer:/
8:perf_event:/
7:memory:/system.slice/sshd.service
6:net_cls:/
5:blkio:/system.slice/sshd.service
4:hugetlb:/
3:devices:/system.slice/sshd.service
2:cpuacct,cpu,cpuset:/
1:name=systemd:/system.slice/sshd.service
The native image fails like this:
Exception in thread "main" java.lang.NullPointerException
at [email protected]/java.util.Objects.requireNonNull(Objects.java:209)
at [email protected]/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:263)
at [email protected]/java.nio.file.Path.of(Path.java:147)
at [email protected]/java.nio.file.Paths.get(Paths.java:69)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.containers.CgroupUtil.lambda$readStringValue$0(CgroupUtil.java:57)
at [email protected]/java.security.AccessController.executePrivileged(AccessController.java:116)
at [email protected]/java.security.AccessController.doPrivileged(AccessController.java:569)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.containers.CgroupUtil.readStringValue(CgroupUtil.java:59)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.containers.CgroupSubsystemController.getStringValue(CgroupSubsystemController.java:66)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.containers.CgroupSubsystemController.getLongValue(CgroupSubsystemController.java:125)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.containers.cgroupv1.CgroupV1Subsystem.getLongValue(CgroupV1Subsystem.java:269)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.containers.cgroupv1.CgroupV1Subsystem.getCpuQuota(CgroupV1Subsystem.java:321)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.containers.CgroupMetrics.getCpuQuota(CgroupMetrics.java:71)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.ContainerInfo.getCpuQuota(ContainerInfo.java:41)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.Containers.activeProcessorCount(Containers.java:90)
at [email protected]/java.lang.Runtime.availableProcessors(Runtime.java:323)
at TestGetProcessors.main(TestGetProcessors.java:3)
Describe GraalVM and your environment:
- GraalVM version (latest snapshot builds can be found here), or commit id if built from source: Built from master, the tip is 3d5b989
- JDK major version: 17
- OS: Linux
- Architecture: AMD64
More details
Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.
PASTE YOUR LOG/STACK TRACE HERE