36 lines
2.1 KiB
Markdown
36 lines
2.1 KiB
Markdown
# PR#157: The processor-time test burns until it measured enough, so a loaded host no longer turns it red
|
|
|
|
> **WARNING:** This document describes only the change applied in this PR.
|
|
> It may already be outdated once the next PR is merged.
|
|
> Historic PR-documentation is not maintained along with new PRs — treat it as a snapshot, not as current documentation.
|
|
|
|
## The Problem
|
|
|
|
The main build of `c218a0c` (PR#156) failed in `ProcessTreeCpuTimeIntegrationTest`, Scenario#67.01.
|
|
The test let a grandchild burn for two seconds of wall clock and expected more than 300 ms of processor time.
|
|
Five other builds ran on mih09 at the same time, so the loop got less than 300 ms.
|
|
The same code was green on its branch a few minutes before, and green again after a restart.
|
|
|
|
The burn was shorter than it looked, too.
|
|
The loop stopped at `date +%s` plus two, in whole seconds, so it ran between one and two seconds.
|
|
|
|
## Non-Goals
|
|
|
|
- No change to `ProcessTreeCpuTime` itself: the measurement was correct, the test asked for too much.
|
|
- No lower threshold: 300 ms is what proves the descent into the tree, far above what the root shell costs.
|
|
|
|
## The Solution
|
|
|
|
- The grandchild loops until it is stopped (`while :; do :; done`).
|
|
- The test samples every 100 ms and stops the loop once the tree has cost more than 300 ms.
|
|
A deadline of 30 s ends the loop if the descent is broken; then the assertion fails as before.
|
|
- A loaded host makes the test slower, not red.
|
|
On an idle machine it ends after about half a second, faster than the old two-second burn.
|
|
- `& wait` in the outer shell makes sure the loop runs as a grandchild, whatever `sh` the host has.
|
|
- The test kills the whole tree afterwards (`descendants()`), since a grandchild outlives its killed parent.
|
|
- The upper bound of 10 s stays: the loop stops one sampling step after the threshold.
|
|
- The local run under twelve busy loops per core stayed green with both versions.
|
|
The red was not reproduced locally, so the proof is the reasoning above and the next loaded build.
|
|
- Werkbaum: PR#157 added to "Flaky tests fixed".
|
|
- Version 1.42.1, with an entry in the release notes.
|