Skip to content

Commit

Permalink
Fix crash in fallback logic if /benchexec cgroup does not exist
Browse files Browse the repository at this point in the history
It is not nice to have to double-check this here
but CgroupsV2.from_system() is also used for other cases
and we cannot easily change it to return only a dummy cgroup
if the cgroup does not exist.
Once we get rid of cgroups v1 we might be able to refactor
and clean up a lot of this.
  • Loading branch information
PhilippWendler committed Jun 4, 2024
1 parent e22ca44 commit 618c2ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion benchexec/cgroupsv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _try_fallback_cgroup():
# If it exists, some deliberately created it for us to use.
# The following does this by just faking a /proc/self/cgroup for this case.
cgroup = CgroupsV2.from_system(["0::/benchexec"])
if cgroup.path and not list(cgroup.get_all_tasks()):
if cgroup.path and os.path.isdir(cgroup.path) and not list(cgroup.get_all_tasks()):
logging.debug("Found existing cgroup /benchexec, using it as fallback.")

# Create cgroup for this execution of BenchExec.
Expand Down

0 comments on commit 618c2ba

Please sign in to comment.