Repository navigation
ci: raise the stack limit before the CodSpeed benchmark steps - #11427
Closed
DharmaBytesX wants to merge 1 commit into
Closed
DharmaBytesX wants to merge 1 commit into
DharmaBytesX wants to merge 1 commit into
Conversation
valgrind-codspeed 3.26.0-0codspeed10 and later report a 4 KiB stack to the program when the soft stack limit is 8 MiB, the default on the runners. CPython 3.14 then delays freeing memoryview objects, and asyncio fails with "BufferError: Existing exports of data". The backend-benchmark job fails on every runner that has such a valgrind build. valgrind reads the limit when it starts, so a ulimit in the benchmark command is too late. Add a step that raises the soft limit of its parent process (the runner worker) to 16 MiB, which the CodSpeed steps inherit. A higher existing limit is kept. Signed-off-by: Simon AURA--SCUSSEL <simon@opsmill.com>
Contributor
Author
|
Closing: the 4 affected runners were repaired by reinstalling valgrind-codspeed 3.26.0-0codspeed9, so all 24 runners now run the same build, and CodSpeed has confirmed the regression and will follow up with a fix. This step is not needed while the CodSpeed action stays on 5.5.0. If a CodSpeed bump that requires build 10 or later is merged before a fix ships, the same workaround applies: a soft stack limit of 16384 KiB or more before the CodSpeed steps (see the description). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
backend-benchmarkjob fails with aBufferErroron runners that have valgrind-codspeed build 10 or later.This adds a step that raises the soft stack limit to 16 MiB before the CodSpeed steps.
Decide: this is a CI workflow change ("Ask First" in
AGENTS.md), and a runner-wide setting is the alternative.Why
Problem: since 2026-10-26 the job fails at test setup on 4 of the 24
huge-runnersrunners, always withBufferError: Existing exports of data: object cannot be re-sizedinasyncio/streams.py, and the job then ends with exit code 139 (failing job, CodSpeed 5.5.0, Python 3.14.7). Each of the 4 runners received valgrind-codspeed3.26.0-0codspeed10during a job of the CodSpeed bump pull requests (#11223, #11342), whose CodSpeed runner 5.6.x requires that build (binary_pins.rsat v5.6.0). The CodSpeed runner 5.5.0 pinned here accepts a newer build and does not downgrade (setup.rs), so these runners keep failing.Cause: since build 10 (PR #53, startup stack layout), valgrind reports a 4 KiB stack to the program when the soft stack limit is 8 MiB. CPython 3.14 reads its stack bounds at startup (
ceval.c) and, with no stack margin, queues garbage-collected objects instead of freeing them (_Py_Dealloc). Thememoryviewinbytes(memoryview(buf)[:n])is then not freed, anddel buf[:n]fails. CodSpeed said in the shared channel that it looks like a regression in that pull request, recommended a stack limit of 16384 KiB or unlimited as a workaround, and will follow up when a release is ready (no public link).Goal: the job passes on any runner, whatever valgrind build is installed.
Non-goals: changing the runners, pinning or downgrading valgrind, fixing valgrind.
What changed
prlimit; the CodSpeed steps inherit it. A higher existing limit is kept. The step prints the resulting limit.ulimitin the benchmark command: valgrind reads the limit when it starts, and CodSpeed runs the command inside valgrind (measure.rs). In the local test,ulimitthere gave the error in 1000 of 1000 runs.How to review
ps, 8 runners). I did not run a job with the step on a runner (see below).prlimit(util-linux 2.39.3) exists in the 3 runner containers I checked.BufferError.How to test
Local reproduction (arm64 Docker, Ubuntu 24.04, the CI's Python builds from actions/python-versions,
bytes(memoryview(buf)[:n])thendel buf[:n], 1000 runs):RecursionErrorat 16 MiB. The exit-time crash seen in the CI jobs was not reproduced exactly.yamllint -sandzizmorreport nothing new.max stack size 16777216.Impact & rollout
Checklist
AGENTS.md)Code review
code-reviewskill ran at levelhighin a separate agent, not the author, on the uncommitted diff againstorigin/stable(1 file, 9 added lines, before the comment change listed below); the agent checked the checkout (branchsas-ci-benchmark-stack-limit, only.github/workflows/ci.ymlmodified).stablethe job fails today on the 4 runners that have build 10 with CodSpeed 5.5.0, and the local and runner tests above show the effect; the proof in a real job is still open (see How to test).bash -e {0}shell is documented by GitHub; I did not run it.Security review
security-reviewskill ran in a separate agent, not the author, ongit diff origin/HEAD...(commit10af29865).origin/HEADisorigin/stable, the base of this pull request, and the diff is the one file shown here.prlimitpresent, hard limit) are covered in How to review.