Skip to content

Commit

Permalink
backport of commit 1bb310d (#16189)
Browse files Browse the repository at this point in the history
This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-nomad-core committed Feb 14, 2023
1 parent d257da3 commit e5e6a5b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/16180.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cgutil: handle panic coming from runc helper method
```
14 changes: 13 additions & 1 deletion client/lib/cgutil/cgutil_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ import (
// cgroups.v1
//
// This is a read-only value.
var UseV2 = cgroups.IsCgroup2UnifiedMode()
var UseV2 = safelyDetectUnifiedMode()

// Currently it is possible for the runc utility function to panic
// https://github.com/opencontainers/runc/pull/3745
func safelyDetectUnifiedMode() (result bool) {
defer func() {
if r := recover(); r != nil {
result = false
}
}()
result = cgroups.IsCgroup2UnifiedMode()
return
}

// GetCgroupParent returns the mount point under the root cgroup in which Nomad
// will create cgroups. If parent is not set, an appropriate name for the version
Expand Down

0 comments on commit e5e6a5b

Please sign in to comment.