{"record":{"id":"9b96421d80aea12a","repo":"hashicorp/nomad","slug":"cannot-open-cpuset","errorCode":null,"errorMessage":"cannot open cpuset","messagePattern":"cannot open cpuset","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/lib/cgroupslib/editor.go","lineNumber":43,"sourceCode":"\treturn root\n}\n\n// OpenPath creates a handle for modifying cgroup interface files under\n// the given directory.\n//\n// In cgroups v1 this will be like, \"<root>/<interface>/<parent>/<scope>\".\n// In cgroups v2 this will be like, \"<root>/<parent>/<scope>\".\nfunc OpenPath(dir string) Interface {\n\treturn &editor{\n\t\tdpath: dir,\n\t}\n}\n\n// OpenFromFreezerCG1 creates a handle for modifying cgroup interface files\n// of the given interface, given a path to the freezer cgroup.\nfunc OpenFromFreezerCG1(orig, iface string) Interface {\n\tif iface == \"cpuset\" {\n\t\tpanic(\"cannot open cpuset\")\n\t}\n\tp := strings.Replace(orig, \"/freezer/\", \"/\"+iface+\"/\", 1)\n\treturn OpenPath(p)\n}\n\n// An Interface can be used to read and write the interface files of a cgroup.\ntype Interface interface {\n\t// Read the content of filename.\n\tRead(filename string) (string, error)\n\n\t// Write content to filename.\n\tWrite(filename, content string) error\n\n\t// PIDs returns the set of process IDs listed in the cgroup.procs\n\t// interface file. We use a set here because the kernel recommends doing\n\t// so.\n\t//\n\t//   This list is not guaranteed to be sorted or free of duplicate TGIDs,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/lib/cgroupslib/editor.go#L25-L61","documentation":"OpenFromFreezerCG1 derives a cgroup v1 interface handle by rewriting a freezer cgroup path (e.g. /freezer/ -> /cpuset/). The cpuset controller does not follow the freezer path layout this helper supports, so requesting iface=\"cpuset\" is treated as a programming error and panics instead of returning a bogus path.","triggerScenarios":"Calling OpenFromFreezerCG1(orig, \"cpuset\") directly, or via enterCG1/configureCG1 with a cgroup v1 configuration where the cpuset controller is requested through the freezer-derived path helper.","commonSituations":"Misconfigured Nomad client cgroup settings listing cpuset in the controllers handled by this code path; running on cgroup v1 hosts where controllers are mounted in separate hierarchies; recent refactors of cgroupslib that reroute cpuset handling incorrectly.","solutions":["Do not pass \"cpuset\" to OpenFromFreezerCG1; use the dedicated cpuset open helper (OpenPath on the cpuset mount point) instead","Verify the client's supported cgroup controllers config excludes cpuset from the freezer-derived path logic","Check cgroupslib version — cpuset handling may belong in a different code path for cgroup v1"],"exampleFix":"// before\niface := OpenFromFreezerCG1(path, \"cpuset\")\n// after\niface := cgroupslib.OpenPath(strings.Replace(path, \"/freezer/\", \"/cpuset/\", 1)) // dedicated cpuset path, not the freezer helper","handlingStrategy":"validation","validationCode":"if iface == \"cpuset\" {\n    // route to the dedicated cpuset helper instead\n    return cgroupslib.OpenPath(path)\n}\n","typeGuard":null,"tryCatchPattern":"func openSafe(orig, iface string) (h cgroupslib.Interface, err error) {\n    defer func() {\n        if r := recover(); r != nil {\n            err = fmt.Errorf(\"cannot open %s cgroup: %v\", iface, r)\n        }\n    }()\n    return cgroupslib.OpenFromFreezerCG1(orig, iface), nil\n}\n","preventionTips":["Never pass \"cpuset\" to OpenFromFreezerCG1","Keep cpuset on its own dedicated open path in cgroupslib","Test client startup on cgroup v1 hosts with all controllers"],"tags":["cgroups","linux","panic","programming-error"],"backgroundTag":"cgroup-controller-not-supported","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}