Skip to content

Deflake TestMultiContainerEvent/enableCgroupsV2 - #14045

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test/cl961130333
Aug 8, 2026
Merged

Deflake TestMultiContainerEvent/enableCgroupsV2#14045
copybara-service[bot] merged 1 commit into
masterfrom
test/cl961130333

Conversation

@copybara-service

Copy link
Copy Markdown

Deflake TestMultiContainerEvent/enableCgroupsV2

The test asserted that the exited "quick" container (/bin/true) reports
non-zero CPU usage via cgroup v2 cpu.stat. The cgroup2fs charging is
correct (exit charges are committed before the parent can reap), but
the sentry accounts task CPU time in whole 10ms clock ticks: a task
that is never running when the ticker fires accrues zero time. A
container as short-lived as /bin/true misses every tick in a few
percent of runs, making the assertion flaky.

Linux never reports 0 here only because it accounts at nanosecond
granularity.

Make the quick container burn a short burst of CPU before exiting so
that several tick boundaries land while it runs, which makes the
accumulated usage reliably non-zero. The v1 and disabled-cgroups
subtests are unaffected: the v1 events path keys ContainerUsage by
container name rather than ID, and the sentry fallback only counts
live thread groups, so both still report 0 for the exited container.

@copybara-service copybara-service Bot added the exported Issue was exported automatically label Aug 7, 2026
@copybara-service
copybara-service Bot force-pushed the test/cl961130333 branch 4 times, most recently from fb1eefb to 8637ff7 Compare August 8, 2026 01:51
The test asserted that the exited "quick" container (/bin/true) reports
non-zero CPU usage via cgroup v2 cpu.stat. The cgroup2fs charging is
correct (exit charges are committed before the parent can reap), but
the sentry accounts task CPU time in whole 10ms clock ticks: a task
that is never running when the ticker fires accrues zero time. A
container as short-lived as /bin/true misses every tick in a few
percent of runs, making the assertion flaky.

Linux never reports 0 here only because it accounts at nanosecond
granularity.

Make the quick container burn a short burst of CPU before exiting so
that several tick boundaries land while it runs, which makes the
accumulated usage reliably non-zero. The v1 and disabled-cgroups
subtests are unaffected: the v1 events path keys ContainerUsage by
container name rather than ID, and the sentry fallback only counts
live thread groups, so both still report 0 for the exited container.

PiperOrigin-RevId: 961224935
@copybara-service
copybara-service Bot merged commit 5ceb9a5 into master Aug 8, 2026
0 of 2 checks passed
@copybara-service
copybara-service Bot deleted the test/cl961130333 branch August 8, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant