Troubleshooting

edit

The library reads and writes the files of /sys/fs/cgroup, so the kernel reports its refusals as file system errors:

ExceptionUsual causeFix
UnauthorizedAccessExceptionThe process may not change this part of the hierarchyRun as root, or work in the part of the hierarchy delegated to your user or service
UnauthorizedAccessException when setting a limitThe file of the limit does not exist: the controller is not enabled on the parent, or the kernel does not support the featureEnable the controller on the parent; GetAvailableControllers lists the controllers you can enable
IOException when enabling a controllerThe control group contains processesMove the processes to a child control group, and enable the controller on the group above them
IOException when setting a limitThe kernel refuses the value, such as a CPU that does not exist in SetCpusetCpusCheck the value against the machine
IOException from DeleteThe control group still has processes or childrenKill the processes, wait for them to exit, and delete the children first
DirectoryNotFoundException when readingThe control group no longer existsCreate it again, or drop the stale CGroup2 instance
  • Reading a value of a controller that is not enabled does not throw: the value is Unavailable. See Reading values.
  • A control group that no longer exists is not reported as a group without controllers: reading it throws a DirectoryNotFoundException, so a stale instance is noticed.
  • The library supports cgroups v2 only. On a machine that still mounts cgroups v1, /sys/fs/cgroup does not have the files the library uses.