Repository navigation
fix: let the forced old-page gate fixture move its block, and bound moved by selected live from below (#9659) - #14927
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…oved by selected live from below (PerryTS#9659) test_old_page_defrag_target_gate_emits_trace minted the parent's shape after its 2 MiB filler, so the shape's keys arrays (GC_FLAG_SHAPE_SHARED, never moved) landed in the parent's source block and the all-or-nothing block evacuation declined. Where BLOCK_SIZE is 1 MiB (macOS) the filler takes an oversized block of its own and never isolates anything. Mint first, then allocate until a new old block starts. copied_minor_fallback_report asserted old_page_moved_bytes <= old_page_selected_live_bytes. The pass moves every indexed occupant of the source block, unmarked ones and other pages' included; measured on the fixed fixture: selected_live 40, moved 4184 (40 marked + 4144 unmarked), released 4184. Require moved >= selected_live whenever anything moved, and keep moved <= released. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
c266c7e to
c636e99
Compare
Summary
The
old_page_forced_defragworkload of the memory-stability gate (compile-smoke, full tier) was red for two independent reasons. Both are fixed here, and both were measured rather than inferred.test_old_page_defrag_target_gate_emits_tracepanicked atoldgen.rs:913("forced old-page defrag should rewrite the shadow root to the moved parent"). The source block was not movable, so nothing moved.old_page_moved_bytes <= old_page_selected_live_bytes. That is the "old_page_moved_bytes(80) > old_page_selected_live_bytes(32)" failure in the issue. The pass moves more than the selected live bytes by design.What was measured
All numbers come from upstream
690e83901don macOS arm64, with temporaryeprintln!instrumentation inevacuate_selected_old_pages_collecting,arena_alloc_gc_oldand the fixture. The instrumentation is not part of this PR.Why nothing moved. The parent's source block on main held four occupants:
TENURED|SHAPE_SHARED|ARENAGC_FLAG_SHAPE_SHAREDTENURED|SHAPE_SHARED|ARENATENURED|ARENA|MARKEDTENURED|ARENAMeasured cycle values were
selected_pages=1,selected_live=40,reclaimable=184,moved=0,released=0. The whole-block pass is all-or-nothing (#7913/#9772), so the two keys arrays make it decline.Where the two arrays come from:
shape_descriptor_ensure(null, 0, 1)call inalloc_old_test_object.0x108100008, arrays and parent at0x103000008…). It never isolates the parent.BLOCK_SIZEis 1 MiB, so a 2 MiB filler gets an oversized block of its own.What the pass moves once it can move. I re-ran the fixture with the shape minted first and allocations continued until a new old block starts. The parent's block then held three occupants: a 4096-byte unmarked filler on another page of the same block, the parent, and the 48-byte dead string.
old_page_selected_pagesold_page_selected_live_bytesold_page_reclaimable_bytesold_page_moved_bytesreleased_original_bytesSo
moved > selected_liveis the designed behavior:evacuate_selected_old_pages_collectingcopies every indexed occupant of the source block, marked or not, on selected pages or not. The report's ceiling contradicts that. The selection's live bytes are a floor instead, because every live byte on a selected page is in the block that moves. The existing ceilingmoved <= releasedstill holds and is kept.Changes
crates/perry-runtime/src/gc/tests/oldgen.rs(test fixture only): mint the parent's shape first, then allocate until a new old block starts (old_arena_block_for_test). This works whatever the platform'sBLOCK_SIZEis.scripts/copied_minor_fallback_report.py: replacemoved > selected_live → errorwith0 < moved < selected_live → error, and keepmoved > released → error.tests/tooling/infrastructure/test_copied_minor_fallback_report.py:old_page_cycletakes the three byte counts. Three tests cover them:Related issue
Refs #9659. The gate is still red after this PR for reasons outside the old-page accounting; see the gate run below.
Test plan
macOS-only local workaround:
perry-runtime's lib test binary does not link on macOS at this commit, becausesnap_census/inventory.rsreferences ELF-only linker symbols. Everycargo test -p perry-runtimebelow used a local linker wrapper (CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER) that aliases those 9 symbols to_mainfor the test binary only. It is not part of this PR.Fixture test, reverting only the fixture change to prove it:
The gate's old-page canaries also pass:
cargo test --release -p perry-runtime --lib -- test_old_page_: 18 passedPERRY_GC_FORCE_EVACUATE=1 PERRY_GC_OLD_DEFRAG=1 cargo test … gc::tests::oldgen::: 27 passedReport on the real trace from the fixed fixture (the
gc_cycleJSON line it emits):Both runs also print
target collector gates require at least one copied-minor workload, because only the one workload was passed.Report unit tests (
python3 tests/tooling/infrastructure/test_copied_minor_fallback_report.py): 27 run, OK. With main's script, the two new bound tests fail, as expected.Full
perry-runtimelib suite with this PR (RUST_TEST_THREADS=1 cargo test --release -p perry-runtime --lib): 6854 passed, 11 failed. The failures are:snap_image::tests::*. These read the ELF section symbols the macOS wrapper aliases; Linux-only per aa769b3.gc::tests::lazy_intrinsic_towers::*gc::roots::runtime_handles::tests::handle_storage_teardown_clears_cache_before_late_scope_dropNone of these is in the module this PR touches. The one
snap_imagetest that is newer than this macOS workaround,the_capture_names_each_reason_replay_cannot_rebuild_and_counts_routes, fails the same way with the fixture change reverted: the same panic atsnap_image/tests.rs:835.Full gate with this PR (
./scripts/run_memory_stability_tests.sh, macOS, aftercargo build-perry --release, sidecars,npm ciandscripts/build_instr_runtime.sh):The gate still reports
FAIL: 4, but the old-page workload now passes.PASS [target-gc] old_page_forced_defrag. On main this workload panics before the report, which leaves the six target workloads' reportblocked.The target-collector report now runs. Its old-page accounting from the gate's own trace:
selected_pages=1,selected_live_bytes=40,reclaimable_bytes=48,old_page_moved_bytes=4184,released_original_bytes=4184,pooled_bytes=1048576. The report finds no old-page error.What still fails is outside this PR. It was measured the same way on main by running the report by hand on main's traces:
[target-gc] architecture stress gates, from the report's other assertions:string_heavyandraw_numeric_layouts:malloc_registry_rebuilds=1, want 0string_heavy: no mutable or shadow root source evidencelarge_object_barriers: missing large-object exclusion telemetryraw_numeric_layouts: no raw numeric object field slots were skippedpointer_free_numeric: no pointer-free slots were skipped[gc-trace] default copied minor churn: all 10 cycles arefull/not_attempted. This is the unscoped-assertion pattern the issue's first comment describes, in the GC acceptance telemetry step.[gc-trace] copied-minor fallback evidence:string_churnhas no mutable or shadow root source evidence.[canary] issue #1425 Fastify/ws manual gc:listen EAGAINon 127.0.0.1 in this sandbox. This is environmental.rustfmtis clean on the touched lines.Full lint (
BASE_SHA=<merge-base> bash scripts/run_lint_gates.sh): 18 of 151 gates FAIL. The FAIL set is identical, by gate name, to full runs on two pristinemaincheckouts from the same day (18 each).🤖 Generated with Claude Code
https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
Summary by CodeRabbit