Skip to content

fix: support cgroup v2 - #349

Merged
Lyt99 merged 1 commit into
alibaba:mainfrom
BSWANG:fix-cgroup-v2-support
Mar 20, 2026
Merged

fix: support cgroup v2#349
Lyt99 merged 1 commit into
alibaba:mainfrom
BSWANG:fix-cgroup-v2-support

Conversation

@BSWANG

@BSWANG BSWANG commented Mar 10, 2026

Copy link
Copy Markdown
Collaborator

Fixes #348

Problem

The tasksInsidePodCgroup function was hardcoded to use the 'memory' subsystem path and 'tasks' file, which only works with cgroup v1.

Changes

  1. Add cgroupV2Mode flag and isCgroupV2() function to detect cgroup version
  2. In cgroup v2 mode, use correct path without 'memory' subsystem
  3. In cgroup v2 mode, use 'cgroup.threads' instead of 'tasks' file
  4. Also update getSandboxPID function to use correct tasks file name

Testing

  • Test on cgroup v1 system
  • Test on cgroup v2 system

The tasksInsidePodCgroup function was hardcoded to use the 'memory' subsystem
path which only works with cgroup v1. This commit adds support for cgroup v2:

1. Add cgroupV2Mode flag and isCgroupV2() function to detect cgroup version
2. In cgroup v2 mode, use correct path without 'memory' subsystem
3. In cgroup v2 mode, use 'cgroup.threads' instead of 'tasks' file
4. Also update getSandboxPID function to use correct tasks file name

Fixes alibaba#348
@BSWANG
BSWANG requested a review from jzwlqx March 10, 2026 08:28
@Lyt99
Lyt99 merged commit 72ea289 into alibaba:main Mar 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

need support cgroupv2

2 participants