Skip to content

#234: stop asserting how many GC runs the collection took - #249

Merged
EdmondDantes merged 2 commits into
mainfrom
234-gc-runs-not-a-contract
Aug 19, 2026
Merged

EdmondDantes merged 2 commits into
mainfrom
234-gc-runs-not-a-contract

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

What was wrong

tests/gc/015-gc_threshold_stable_in_async.phpt asserted runs: 4. That counter says how often the GC coroutine got scheduled during the run, which the code under test does not decide. On LINUX_X64_DEBUG_ZTS_ASAN two full root buffers merge into a single deferred collection and the test reports 3, with the same 80000 objects collected:

     threshold before: 10001
     threshold after: 10001
003- runs: 4
003+ runs: 3
     collected: 80000

Measured on the same body, without ASAN, by moving only the point where the GC coroutine gets a chance to run:

delay(1) every 10000 cycles  ->  runs: 4   collected: 80000
delay(1) every 40000         ->  runs: 1   collected: 80000
no delay at all              ->  runs: 1   collected: 80000

The collected count never moves; the run count moves by a factor of four.

What changed

The test now says that deferred collection happened at all, which is what that counter was added to guard — the comment in the test says as much. The threshold assertions and the exact collected count are untouched, so what the test proves about #234 is unchanged.

Verification

12 runs of the test and the whole tests/gc group, 23 tests, 0 failed. Not reproduced without ASAN: 12 clean runs and 15 under 24 spinning load generators all gave 4.

The test pinned gc_status()['runs'] at 4. That number says how often the GC
coroutine got scheduled, not what the test is about, and under ASAN two full
root buffers merge into one run: the ASAN job reported 3 with the same 80000
objects collected.

Measured on the very body of this test: a delay every 10000 cycles gives four
runs, one every 40000 gives one, and no delay at all gives one, while collected
stays 80000 throughout. The test now asserts that deferred collection happened
at all, which is what the counter was there to guard, and keeps the threshold
and the collected count exact.
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@EdmondDantes
EdmondDantes merged commit 60ed5f5 into main Aug 19, 2026
9 checks passed
@EdmondDantes
EdmondDantes deleted the 234-gc-runs-not-a-contract branch August 19, 2026 13:24
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.

1 participant