Skip to content

Keep object candidates from retaining unrelated arrays during conservative GC - #417

Draft
284km wants to merge 15 commits into
mainfrom
fix-corpus1074-gc-retention
Draft

284km wants to merge 15 commits into
mainfrom
fix-corpus1074-gc-retention

Conversation

@284km

@284km 284km commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Review follow-up (2026-12-03): VM/GC-stress Major remains open; this PR is not ready to merge. The successful hosted 4,000-trial measurements below used the older runtime without GC stress; they are historical evidence, not acceptance of the review configuration. I reproduced the new finding on macOS (main 20/20 versus prior integration 12/20 at stress=20 in each index mode). An initial candidate passed 512/512 macOS trials, but subsequently failed on local Ubuntu/x86-64 under emulation at VM/stress=20 (6th trial, index ON). That candidate is rejected as a complete fix and has not been pushed. The original corpus and its object bound remain unchanged.

889044a4 addresses the replay-workflow Major, CI/positive-output Minor and Array-only comment: deletes the workflow and both replay scripts, runs the durable candidate gate in ordinary macOS and Linux CI, and requires the positive success transcript. Current main 3c58e049 is merged. Runtime investigation continues. The reported 125.0→129.0 MB micro-benchmark cannot yet be repeated exactly without its program and four seeds; no claim that this reported peak increase is harmless or fixed is made.


Historical ordinary-GC investigation and measurements (runtime dc64b3b8):

A conservative stack candidate currently marks the same number as every Ruby handle kind. Individual Mark1074 objects and unrelated Arrays share that number space, so finding one object can also retain an unrelated 1,000-object Array. This can push corpus 1074 above its live-object bound depending on stack contents, environment and invocation context.

Give Array handles a separate internal range. Keep public Array identity serials and inverse lookups unchanged, adjust allocation statistics, and start Array watermarks in the Array range—including missing frame watermarks. Conservative scanning, its pinning rules and GC thresholds are preserved.

Validated on native Ubuntu: all 4,000 repaired trials pass (1,000 in each engine/index mode; workflow 4bdefa9c, runtime unchanged from dc64b3b8). The original corpus/1074_a_landed_return_value_is_not_kept.rb is byte-for-byte unchanged: five calls, both 1,000-object allocation sites, ten explicit collections, last < 1500, and every returned-value assertion. No timeout, object bound or workload reduction is proposed.

Direct root-cause check

tools/gc_candidate_kinds_check.py compiles the production arr_new, gc_mark_wm, gc_mark_cand and the actual interval/direct frame-watermark readers in a small fixture. It records which typed roots the candidate marker requests. An Object candidate must retain the Object, without marking an unrelated Array; an Array candidate must still retain that Array. Initial Array and non-Array watermarks are checked too, including running and suspended frames with no recorded watermark.

The repaired fixture passes. Reverting only the Array base to the shared Object base fails with “object candidate rooted an unrelated array”, as required by the negative control. The test-only follow-up 599fcd29 additionally restores the old default in each production reader independently; both mutations fail before any enormous interval walk. All four expected-outcome controls pass locally at O2 with the exact CI-pinned Mere compiler; the native replay workflow repeats them at O2 before building the complete interpreters. This tests the wrong-kind root directly, independently of whether a particular stack layout happens to reproduce a live-object failure.

The existing identity-domain corpus now also checks Array identity reverse lookup before and after GC. Related GC/Fiber/ObjectSpace programs check that legitimate values remain alive, including values in flight after removal from a container. MERE_RUBY_VM=why confirms that the unchanged 1074 program runs on the VM.

Native Ubuntu reproduction and failure rates

Reported failure: main b5c4249a, run 46552591651. Both hash-index settings printed false, with correct later value checks. Its tree is identical to PR #416's final head 0e30b093; its PR Linux corpus step passed.

Every trial is a fresh process. Both builds use compiler 72bb0d0980f22c067c323695815c15bc20331898, ordinary O2, mgz 661a01d8bb68f5acd68e3192bd47f081d179c436, and the original input SHA-256 1370e3b38730e8a1ba600375c4eb1a11698ca8b069196be457ba95add420d6af. The supervisor preserves stdout/stderr/status/timing for every trial, selects both engines/index settings explicitly, and compares all outputs against Ruby 4.0.10. Historical first-line false is counted; any repaired failure, unexpected output, diagnostic, altered input, crash or timeout fails acceptance.

Final native replay passed: x86-64 ubuntu-24.04, image 20261122.23.1. Both shards completed their full 3,000 trials and accepted the repaired build. The historical VM/index-OFF failure rate was 7/500 (1.4%); the repaired observed rate was 0/1000 in each mode. No repaired failure, unexpected stdout/stderr, crash or child timeout occurred. Maximum child wall time across all 6,000 trials was 0.1594 s.

Every trial, timing, hash and direct root-kind control is retained in the evaluator artifact and VM artifact. Both shards built byte-identical executables for each source:

  • Historical SHA-256: 0c3825b08f8f4ee89cda4245a540a2d9cedbaaea9c676b7bc442418d3024fb85
  • Repaired SHA-256: 89ed3d8a17f8b156048caceb404f2e2cd08cd73dcf8ec00b04e023ef3ef2dc42
Final native build Evaluator ON Evaluator OFF VM ON VM OFF
Historical b5c4249 0/500 0/500 0/500 7/500 (1.4%)
Repaired dc64b3b 0/1000 0/1000 0/1000 0/1000

Median child wall times (seconds, historical → repaired): evaluator ON 0.13695 → 0.13667, OFF 0.13749 → 0.13739; VM ON 0.14032 → 0.14112, OFF 0.14083 → 0.14180. This is a live-object retention repair; the historical failures were Boolean false, not deadline errors.

The preceding single-job run reached its 30-minute measurement-job deadline after 5,883 trials. Its preserved raw records show:

Interrupted run Evaluator ON Evaluator OFF VM ON VM OFF
Historical b5c4249 0/500 0/500 1/500 4/500
Repaired dc64b3b 0/971 0/971 0/971 0/970

The repaired 3,883 trials all passed. Every child finished in under 0.237 s; no child timed out. This incomplete run is not claimed as full acceptance. Building both sources took 9m43s, and 5,883 trials took 1,210.8 s; extrapolating the remaining 117 trials gives about 30m36s including setup, before artifact cleanup. Split by engine, each shard has 3,000 trials and projects about 20.5 minutes on that runner, leaving about 9.5 minutes of the unchanged 30-minute job bound. All four modes retain the full 500/1,000 repetition counts, and fail-fast is disabled so one shard cannot cancel the other. The completed evaluator and VM jobs took 15m16s / 15m00s, leaving 14m44s / 15m00s of actual headroom. No test or supervisor limit was raised.

Independent earlier native observations, same image 20261122.23.1 and pinned compiler:

Original b5c4249 input/build Evaluator ON Evaluator OFF VM ON VM OFF
Run 46580995699 0/500 0/500 0/500 3/500 (0.6%)
Run 46584294808 0/500 0/500 0/500 7/500 (1.4%)

The historical binary was byte-identical in those runs: SHA-256 0c3825b08f8f4ee89cda4245a540a2d9cedbaaea9c676b7bc442418d3024fb85. These are conditional rates for those executions, not a hosted-fleet estimate. Failed trials exited 0, with a Boolean retention failure and correct subsequent value checks; there were no malformed outputs or timeouts.

Moving the count after the loop was insufficient (native evaluator ON/OFF each failed 1000/1000, VM OFF 2/1000). Reclaiming only the flow-message arena also failed one of 1,000 native evaluator/index-OFF trials, after an initial 800-trial sample had passed. Both approaches were rejected; their corpus/runtime changes are absent from this PR. All trials for the rejected count relocation and the rejected arena candidate are retained. Those rare failures motivated the final 1,000 trials per mode.

Local Linux checks

Host: Apple M2 Pro, Ubuntu 24.04.5 Linux/x86-64 under Docker emulation, Clang 18.1.3. C was emitted by each pinned compiler on macOS and compiled at O2 inside Linux. These are supplementary to native Ubuntu acceptance.

Original program / build context Evaluator ON Evaluator OFF VM ON VM OFF
f0f372e, CI compiler 9dec2ff6, bind-mounted checkout 0/100 100/100 10/100 0/100
b5c4249, CI compiler 72bb0d09, bind-mounted checkout 0/100 100/100 0/100 0/100
Same b5 binary copied into ordinary container storage 0/100 0/100 0/100 100/100
Preliminary Array-namespace candidate b6a2e0f 0/200 0/200 0/200 0/200
Final Array-watermark candidate dc64b3b 0/100 0/100 0/100 0/100

Different invocation/storage/environment contexts change which conservative aliases survive. Excluding the interrupted-stack scan (MERE_RUBY_GC_DBG=4, unsound as a repair) made historical failures disappear in diagnostic screens. No scan exclusion is used in the fix or acceptance runs.

Final local validation: 400/400 original-program trials pass; 64/64 comparisons across 16 related GC/Fiber/ObjectSpace/identity programs and four modes match Ruby 4.0.10. No diagnostics, crashes or timeouts. Final local binary SHA-256 a06a6febd45065cf9958d62c5cc1f7ba83932adabb8d55557814dfb1a6683804. The GC-root, region, duplicate/dead-definition, method/ivar-write, namespace/name-length and regex-capture source gates pass. Replay acceptance fault-injection tests: 6/6 pass, including complete per-engine shard counts.

Module timeout investigation

The requested 98aa4531 / ce0fd9cf / f0f372e7, both-engine, median-of-three wall time and retired-instruction measurements and all samples are in the #412 investigation comment. Median instructions differed by less than 0.14%; green 98aa4531 already had only 0.70/1.14 s of nominal headroom. Identical Linux binaries failed on one runner and passed on another; unrelated controls were 1.6–1.7x slower too. This supports runner-dependent throughput, without distinguishing hardware differences from contention.

The comment proposes reducing class-metadata construction and collection costs, supported by profiles (GC 26–47% of the leak loops; final GC only milliseconds), and specifies unchanged-memory-bound verification on the slower Linux runner class. It does not claim an implemented or measured Module speedup. This PR addresses the separate Array-liveness issue and leaves both Module child deadlines unchanged.

Full PR CI on 4bdefa9c completed successfully (42 successful checks, one intentionally skipped evaluator-vs-VM check), including build-linux/Module, the full corpus and C API. The test-only follow-up 599fcd29 leaves runtime, corpus and build inputs unchanged; its fresh CI is in progress. No Module speedup is claimed.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 9940656ccd58edee9c11af02909017e93d44a06b against current main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e, including their prospective integration (tree 2355e42d08e8a0cdd72d24a9eca53c225d1e003e). No actionable code findings.

Giving flow_sig its own arena from creation follows the existing store-ownership pattern. The active-message root remains intact, and the new regression checks return/break/throw values through collection during unwinding.

Validation performed:

  • Fresh ordinary O2 runtime builds on macOS arm64 for head, current main, and their integration, using the existing compiler executable from a clean checkout of pinned Mere 72bb0d09 and pinned mgz 661a01d8. Runtime binaries were built separately, not reused.
  • 192/192 stdout/exit-status comparisons against Ruby 4.0.10: 16 GC/control-flow/fiber corpus programs on all three builds, each with evaluator/VM and hash index ON/OFF. This includes the unchanged original 1074 case and the new 1166 unwind case.
  • The unchanged 1074 program additionally passed 80/80 fresh-process trials on the PR head, 20 per mode. These local passes do not by themselves establish a deterministic historical baseline.
  • Replay fault-injection controls: 4/4 pass. GC-root, region-ownership, duplicate-definition and dead-definition source gates pass; whitespace checks pass.
  • Independently inspected the successful native Ubuntu replay and its 1,200 recorded trials. Historical VM/index-OFF retention failed 1/100 times; the other three historical modes failed 0/100. The repaired build passed 200/200 in each mode (800/800 total), with no invalid transcripts. Both inputs retain SHA-256 1370e3b38730e8a1ba600375c4eb1a11698ca8b069196be457ba95add420d6af and the original threshold.

Full hosted corpus/upstream/platform acceptance is still pending: Linux build, some macOS gem tests, CRuby/bootstrap shards and other downstream jobs remain running or queued. This review does not claim complete memory/resource or cross-platform acceptance. The PR is still a draft; no merge was performed, and existing global merge holds remain in place. Current main's separate Wasm failure log records a runner shutdown and exit 143, not a program assertion failure; that observation does not clear the recorded holds.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review of c2b1892d4da378c9f9058550032d290cce2eb71d against current main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e, including prospective integration tree 0030516d55af997853a691432f0d3dce21b89ac8. No actionable findings.

The revised placement keeps arena reclamation in the existing nc-guarded compaction phase rather than root marking, which also runs during Fiber reclamation. Active messages remain rooted; consumed entries can be reclaimed, and their arena now contributes to GC pressure. The original 1074 input and its threshold remain unchanged.

Validation performed on macOS arm64:

  • Fresh ordinary O2 builds for this head and its current-main integration, using pinned Mere 72bb0d09 and mgz 661a01d8. Reused the existing pinned compiler executable from its clean exact-revision checkout. Reused the previously tested main O2 runtime only after comparing all 2,900 tracked main files and all 18 mgz files byte-for-byte with the freshly fetched sources; no mismatches. Its binary SHA-256 remains bf045d849726aa7ece634862ef31a21f8588632571a6a4bb4daf2e8e246c0850.
  • 192/192 stdout/exit-status comparisons against Ruby 4.0.10: 16 GC/control-flow/Fiber programs across head, main and integration, each with evaluator/VM and hash index ON/OFF.
  • The new unwind case also passes all eight GC-stress comparisons across head/integration and four modes. The unchanged original 1074 case passes another 80/80 fresh-process head trials, 20 per mode.
  • Replay fault-injection controls: 4/4 pass. GC-root and region-ownership gates pass on both freshly generated C files; duplicate/dead-definition and whitespace checks pass.

The final 500/1000 native Ubuntu replay is still running; the earlier preliminary replay is not evidence for this revised binary. Core Linux/corpus, CRuby/bootstrap and tool validation also includes running or queued jobs. These focused checks do not establish complete platform or memory/resource acceptance. Latest main CI's 27 jobs were inspected, including its recorded Wasm failure. The PR remains a draft; no merge was performed, and recorded global merge holds remain unchanged.

@284km 284km changed the title Give consumed flow messages a reclaimable arena Count landed return payloads after the leak loop Dec 1, 2026

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review of 960a733a0e1f065f8bdba4c4c6fe96c009e3ad2a against main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e, including prospective integration tree 87abb8c2c78cb7675d19a6c113eed3a8dd2bad1e. One Major (P2) finding: relocating the observation still fails in a controlled local context and can turn a passing original input into a failing one.

The final diff preserves the workload, collection count, bound and returned-value assertions; all earlier runtime changes are gone. Replay fault-injection checks pass 5/5, and both exact corpus inputs produce identical successful output on Ruby 4.0.10. Whitespace checks pass. No tracked AGENTS.md or CLAUDE.md exists on base/head.

Validation on Darwin arm64 reused the previously built ordinary O2 current-main binary (SHA-256 bf045d849726aa7ece634862ef31a21f8588632571a6a4bb4daf2e8e246c0850, pinned compiler 72bb0d09, mgz 661a01d8). All 2,900 tracked current-main files were independently compared byte-for-byte with that build's checkout, with no mismatch; the integration changes only these four corpus/replay files. No new runtime build is claimed.

  • Initial four-mode fresh-process comparison: original 80/80 pass; relocated 60/80 pass, with 20/20 VM/index-ON retention failures.
  • Controlled follow-up at the same absolute input filename, same working directory, binary and environment, alternating only the exact source bytes: original 10/10 pass; relocated 10/10 fail in VM/index-ON. Exit 0, no stderr, first line false; every subsequent value output remains correct.
  • Separate relative-path replay with a clean environment: both inputs fail 20/20 evaluator/index-OFF trials; each passes the other 60 trials. These are preserved baseline failures, not additional new regressions.

The exact-head native Ubuntu replay and broader hosted CI remain in progress/queued; the negative-control acceptance described in the PR is still pending. These local observations neither establish a GC root cause nor claim platform-wide acceptance. All 27 latest-main CI jobs were inspected; its Wasm failure records runner shutdown/exit 143. This is a draft, all other open PRs are drafts, and recorded global merge holds remain active. No merge performed. Because this is the authenticated user's own PR, this review uses COMMENT rather than REQUEST_CHANGES.

@284km 284km changed the title Count landed return payloads after the leak loop Investigate landed return payload retention on Linux Dec 1, 2026

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review of 0b7a61cac23750cd8695aa5350796d250eac8d98 against freshly fetched main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e (prospective integration tree 1d4c954a6059320554c87d6441155e4319d48c18). No new actionable findings; the existing Major/P2 retention finding remains unresolved and is not duplicated inline.

The updated description correctly marks this investigation as unresolved. The diagnostic workflow now holds the invocation filename constant across variants and deliberately exits unsuccessfully rather than presenting the screen as repair acceptance. Extra collections and root-scan exclusions appear only in diagnostic variants; they do not establish an acceptable repair.

Validation performed:

  • Inspected all five changed files, surrounding GC diagnostic controls, existing reviews and the unresolved discussion. No tracked AGENTS.md or CLAUDE.md exists on fetched base/head.
  • Replay fault-injection checks: 5/5 pass. Both frozen corpus inputs have the expected SHA-256 and identical successful stdout/exit status, without stderr, under Ruby 4.0.10. Whitespace checks pass.
  • Independently inspected the completed native Ubuntu acceptance log: the two executable hashes are identical; historical VM/index-OFF failed 7/500, and the relocated input failed evaluator/index-ON 1000/1000, evaluator/index-OFF 1000/1000, and VM/index-OFF 2/1000. All other modes had zero failures and all transcript-validity counts were zero. Acceptance is explicitly false. The input files and replay implementation are unchanged since that run; these are recorded historical-binary results, not a newly built current-main result.

The new exact-head diagnostic workflow and broader hosted CI remain running/queued. No fresh runtime build or full platform/resource acceptance is claimed. The draft and unresolved P2 prevent merging; recorded global merge holds remain unchanged. All currently open PRs in both watched repositories are drafts, so none was merged. This is a COMMENT review on the authenticated user's own PR.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review of 4615b73d226ed99c7a4264ab528f682a159dbec4 against current main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e, including prospective integration tree 9f1b9e518b2e4cf751d3c57955c7983bb3f17bd7. One new Major/P2 finding: missing Array watermarks still default to the old handle base, causing a practically unbounded GC interval scan.

The original 1074 corpus is restored byte-for-byte; the previous observation-relocation finding therefore no longer applies to the current corpus diff. The new candidate-kind control correctly rejects overlapping object/Array handles, and the expanded identity case checks Array reverse lookup before and after collection. This does not yet establish a complete retention repair.

Validation on macOS arm64:

  • Fresh ordinary O2 builds of the runtime candidate and its main integration, with pinned Mere 72bb0d09 and mgz 661a01d8. The subsequent 4615b73d update changes only the workflow, Python tools and corpus 619; all runtime/build inputs remain byte-identical to these freshly tested builds. Reused the pinned compiler executable from its clean exact-revision checkout. Current-main runtime reuse was independently checked against all 2,901 tracked entries and all 18 mgz files, with no byte mismatches; main binary SHA-256 remains bf045d849726aa7ece634862ef31a21f8588632571a6a4bb4daf2e8e246c0850.
  • 264/264 stdout/stderr/exit comparisons against Ruby 4.0.10: 22 GC/control-flow/Fiber/identity/allocation corpus programs on head, main and integration, across evaluator/VM and hash index ON/OFF. The updated corpus 619 additionally passes all 12 comparisons.
  • Original 1074: another 160/160 fresh-process trials pass across head/integration, 20 per mode. These focused local passes do not replace the required native acceptance.
  • Replay fault-injection checks: 5/5 pass. New production candidate-kind and overlapping-ID negative controls pass on head and integration. GC-root, region-ownership, duplicate/dead-definition and whitespace gates pass.
  • New regression: with MERE_RUBY_GC_STRESS=1, [[]].each { |a| p ObjectSpace._id2ref(a.object_id).equal?(a) } succeeds on main in 0.19 s (evaluator) / 0.17 s (VM), but exceeds 5 s with empty stdout/stderr on both head and integration in both engines. A larger identity probe also exceeds 30 s on head; main completes it. Sampling the minimal candidate process confirms execution in gc_mark_roots -> the interval loop -> gc_mark_wm.

The new native Ubuntu 500/1000 replay and broader hosted CI are still running/queued; no complete Linux/platform/resource acceptance is claimed. The previous diagnostic workflow's intentional exit 1 was inspected separately and is not treated as an acceptance result. All 27 jobs of latest main CI were inspected, including its recorded Wasm failure; existing holds remain unchanged. All open PRs in both watched repositories remain drafts, so none was merged. This is a COMMENT review because the PR belongs to the authenticated user; the new P2 requires a fix before merging.

Comment thread m_fiber.mere Resolved
@284km 284km changed the title Investigate landed return payload retention on Linux Keep object candidates from retaining unrelated arrays during conservative GC Dec 1, 2026

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review of dc64b3b8383ba30fbb86f82f5aee0cf0a27f98c0 against freshly fetched main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e, including prospective integration tree a63f9dfd89963634a16cfea8ae07fd2c9061a6c0. No new actionable findings. The previous Major/P2 missing-Array-watermark finding is fixed in this head.

Both watermark readers now use the kind-specific fallback. The exact GC-stress reproduction from the previous finding completes with true on head and integration in both engines/index settings (approximately 0.16–0.22 s), rather than timing out. The larger Array identity/reverse-lookup probe also passes with GC stress. The original observation-relocation finding remains inapplicable: corpus 1074 is restored byte-for-byte, including its workload, explicit collections and last < 1500 bound. Separating internal Array handles while preserving public identity serials is consistent across the allocation, identity, reverse-lookup and allocation-statistics paths inspected.

Validation performed on macOS arm64:

  • Fresh ordinary O2 runtime builds for this head and its current-main integration, using pinned Mere 72bb0d09 and mgz 661a01d8. Reused the compiler executable from its clean exact-revision checkout. Reused the existing main O2 runtime only after independently comparing all 2,900 tracked files and all 18 mgz files byte-for-byte against fetched main, with no mismatches; main binary SHA-256 remains bf045d849726aa7ece634862ef31a21f8588632571a6a4bb4daf2e8e246c0850.
  • 264/264 stdout/stderr/exit comparisons against Ruby 4.0.10: 22 GC/control-flow/Fiber/identity/allocation corpus programs across head, main and integration, each with evaluator/VM and hash index ON/OFF.
  • 24/24 additional GC-stress comparisons for the minimal previous reproduction and larger identity probe across those three builds and four modes.
  • Unchanged original 1074: 160/160 additional fresh-process trials pass across head/integration, 20 per mode.
  • Production candidate-kind positive and overlapping-ID negative controls pass on head and integration; replay fault-injection checks pass 5/5. GC-root and region-ownership gates pass on both newly generated C files. Duplicate/dead-definition, method/ivar-write, name-specification, regex-capture, namespace, name-length and whitespace source checks pass on head. No tracked AGENTS.md or CLAUDE.md exists on fetched base/head.

The exact-head native Ubuntu 500/1000 replay is still running. Its candidate-kind and build steps have passed, but no completed repetition acceptance is claimed. Broader hosted validation also has running/queued work, including Linux build, corpus, reference tests, macOS gem tests and downstream CRuby/bootstrap/tool matrices. These local checks do not establish complete cross-platform or memory/resource acceptance.

All 27 jobs of latest main CI were inspected; its recorded Wasm failure reports runner shutdown/exit 143, not a program assertion failure. Existing global merge holds remain unchanged. All currently open PRs in both watched repositories are drafts; no merge was performed. This is a COMMENT review because the PR belongs to the authenticated user.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review of 4bdefa9c19ea5b3ef0aef0862d33d889b49afd5c against freshly fetched main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e, including prospective integration tree 93c9587100167a9b2d7eeae985cadb000c398a8c. No new actionable findings.

The update changes only the replay workflow and two Python tools, both at the PR head and in its main integration. All other tracked entries, including runtime, compiler/build inputs and corpus programs, are unchanged from the previous reviewed head/integration. The earlier missing-Array-watermark fix remains present in both readers; the observation-relocation finding remains inapplicable because the original 1074 input is unchanged. Existing threads were left untouched.

Splitting evaluator and VM into separate jobs preserves both hash-index modes, 500 historical and 1,000 repaired trials per mode, the 30-minute job limit, and the 30-second child deadline. Disabling matrix fail-fast preserves independent evidence from both engines, and distinct artifact names avoid shard collisions.

Validation performed:

  • Replay acceptance tests: 6/6 pass. Six additional focused controls across evaluator/VM shards confirm complete per-shard counts and rejection of repaired retention failures and stderr diagnostics.
  • Recomputed both current-main integration trees and compared all tracked entries: only the three workflow/tool files differ from the previously reviewed integration. No fresh runtime build or new runtime/platform acceptance is claimed; the previous O2 runtime/regression evidence remains associated with those unchanged sources.
  • Original corpus 1074 has the same SHA-256 on current base/head: 1370e3b38730e8a1ba600375c4eb1a11698ca8b069196be457ba95add420d6af. Whitespace checks pass. No tracked AGENTS.md or CLAUDE.md exists on either revision.
  • Independently downloaded the preceding native replay artifact. Its 5,883 records contain 2,000 historical trials (one VM/index-ON and four VM/index-OFF retention failures) and 3,883 repaired trials with zero failures or invalid transcripts. Repaired counts are 971/971/971/970, so this cancelled execution is incomplete and does not establish full acceptance; no summary.json was produced.

The new two-shard native replay is still in progress. Both candidate-kind controls have passed, but repetition acceptance remains pending. Broader Linux/macOS builds, reference tests, gem suites and downstream corpus/CRuby/bootstrap/tool coverage are not yet complete. These are running tests as well as queued work, so the runner-queue merge exception does not apply.

Inspected all 27 jobs of latest main CI: 25 succeeded, one was skipped, and the recorded Wasm failure remains preserved. Existing global merge holds are unchanged. All open PRs in both watched repositories are drafts; no merge was performed. This is a COMMENT review on the authenticated user's own PR.

@284km
284km marked this pull request as ready for review December 1, 2026 07:21

@284km 284km left a comment •

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completion follow-up for head 4bdefa9c19ea5b3ef0aef0862d33d889b49afd5c against current main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e. No new actionable findings. The previously pending native Ubuntu lifetime replay is now complete and accepted.

I independently downloaded both artifacts from run 46595317974, checked all 6,000 trial records, recomputed transcript verdicts and per-mode counts, and checked the positive/negative candidate-kind control transcripts:

  • Repaired integration: 1,000/1,000 pass in each of evaluator/VM × hash index ON/OFF, 4,000/4,000 total. No unexpected stdout, stderr, crash or child timeout.
  • Historical b5c4249a: VM/index-OFF has 7/500 retention failures; the other three modes each have 0/500. All later value outputs remain correct, with no invalid transcripts.
  • Maximum child wall time across all trials is 0.1594 seconds. Both shards record identical historical and repaired executable hashes (0c3825b0… and 89ed3d8a…). The original corpus input retains SHA-256 1370e3b38730e8a1ba600375c4eb1a11698ca8b069196be457ba95add420d6af; workload, collections and last < 1500 are preserved.

The logs show native x86-64 Ubuntu 24.04, pinned Mere 72bb0d09, mgz 661a01d8, ordinary O2 builds, and successful production candidate-kind and overlapping-ID negative controls. The tested checkout is GitHub integration commit 7f5ff4fc, whose tree 93c9587100167a9b2d7eeae985cadb000c398a8c matches my independently recomputed current-main integration.

Local verification in a fresh temporary clone: replay acceptance tests 6/6 pass; whitespace checks pass; no AGENTS.md or CLAUDE.md exists on fetched base/head. Comparing all tracked entries with the previously reviewed dc64b3b8 head and its integration confirms that only the replay workflow and two Python tools changed. Both kind-specific watermark fallbacks remain fixed, and the observation-relocation finding remains inapplicable because the original input is restored. Existing threads were left untouched. No fresh local runtime build or additional macOS runtime acceptance is claimed in this follow-up.

Broader CI remains incomplete: Linux and macOS builds and three macOS gem suites are running; downstream corpus/CRuby/bootstrap/tool coverage is not complete. This is not solely unassigned runner queueing. All 27 jobs of latest main CI were inspected: 25 succeeded, one skipped, and the Wasm failure log records runner shutdown/exit 143. Historical failures and the recorded global merge holds remain preserved. No merge performed. Other open mere-ruby PRs are drafts; merelang/mere has no open PRs. COMMENT on the authenticated user's own PR.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review of 599fcd2983724cd07d4d6a2b4ad86f91242122c3 against freshly fetched main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e, including prospective integration tree 8a1444ecb982a973fe7a2e5585af8c6edfafa643. No new actionable findings. Both earlier P2 findings remain addressed: the relocated observation is absent, and both production watermark readers retain the kind-specific fallback. Existing threads were left untouched.

The new test strengthens the previous fix by exercising the actual interval and direct readers with unwritten running and suspended frame watermarks. Restoring the old default in each reader independently now fails before an enormous interval walk. This gives useful, targeted regression coverage.

Independent validation in a fresh temporary clone on macOS arm64:

  • Compared all tracked changes since reviewed head 4bdefa9c and recomputed both current-main integration trees: only tools/gc_candidate_kinds_check.py changes. Runtime, build inputs, workflow and corpus are unchanged from the previously reviewed/native-tested sources.
  • All four O2 candidate-kind controls pass on both head and current-main integration: repaired positive case, overlapping-handle negative case, and separate old-default mutations for each reader (8/8 expected outcomes). Used the existing compiler executable from a clean checkout of pinned Mere 72bb0d0980f22c067c323695815c15bc20331898; no full runtime binary was rebuilt or executed in this follow-up.
  • Replay acceptance fault-injection tests pass 6/6. Original corpus 1074 is byte-identical to current main with SHA-256 1370e3b38730e8a1ba600375c4eb1a11698ca8b069196be457ba95add420d6af. Whitespace checks pass. No tracked AGENTS.md or CLAUDE.md exists on fetched base/head.
  • Independently inspected all 27 jobs of the previous head's core CI run 46595318091: 26 successful, one evaluator-versus-VM comparison skipped. The prior completion review independently verified the 6,000 native replay records, including 4,000/4,000 repaired trials; that existing evidence is reused for unchanged runtime sources, rather than claimed as a new replay.

Current-head core CI run 47034277101 still has executing Linux/reference jobs and incomplete downstream coverage; native replay run 47034277107 is also executing. This is not solely unassigned runner queueing. All 27 jobs of latest main CI run 46559447762 were inspected: 25 succeeded, one skipped, and Wasm failed after a runner shutdown/exit 143. No program assertion failure is inferred from that log; recorded historical failures and global merge holds remain preserved. No merge performed. COMMENT because this is the authenticated user's own PR.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head 4bdefa9c19ea5b3ef0aef0862d33d889b49afd5c (runtime identical to the newer 599fcd29, which changes only tools/gc_candidate_kinds_check.py). Measured on macOS arm64. Everything was built at O2 with the CI-pinned Mere 72bb0d09 (v0.1.733): current main 3c58e049, this PR merged into main, and the PR head and its base b5c4249a built separately.

Earlier rounds already covered the missing-Array-watermark default and the relocated observation. I don't repeat those here.

Major

1. With GC stress on the VM, corpus 1074 now fails where main passes. The original, unchanged program, MERE_RUBY_VM=1, first line of output:

Build GC_STRESS=20, index ON GC_STRESS=20, index OFF GC_STRESS=50, index ON GC_STRESS=7, index ON
main 3c58e049 20/20 true 20/20 8/8 8/8
main + this PR 9/20 true (11 false) 10/20 (10 false) 3/8 (5 false) 8/8
base b5c4249a 12/12 — — —
PR head alone 8/12 (4 false) — — —

On the evaluator, all four builds pass 20/20 with stress in both index modes, and without stress everything passes 50/50 per mode. The failures look like the original bug: exit 0, no stderr, false first, and every later value correct. In the MERE_RUBY_GC_LOG=1 traces, a failing run keeps one more Array for the rest of the program (arr=61 where a passing run drops to arr=59/60). It also does about 500 more collections (2,200 against 1,699), because the following each_object walks the extra 1,000 objects.

The diagnostic bits show which root route is involved:

  • With MERE_RUBY_GC_DBG=2, which leaves out the interrupted stack's watermark intervals, this PR passes 10/10.
  • With GC_DBG=1, it passes 7/10.
  • With GC_DBG=4, it fails 10/10, but so does main.

So the extra retention comes through the interrupted stack's watermark intervals (fb_stack_wm_iv → gc_mark_wm_merged), not through the conservative scan the PR is targeting. I could not find the cause by reading: the kind-1 intervals should be the same numbers moved by arr_handle_base - handle_base. It needs an explanation and a fix (or evidence that it is not caused by the change) before merge. The PR fixes exactly this last < 1500 assertion, and in this configuration it is now worse than main. The stress run is cheap to add to the replay or the corpus.

2. .github/workflows/corpus1074-replay.yml should not land on main in this form (inline). It runs on every pull_request that touches main.mere, m_state.mere or m_fiber.mere. That was 25 of the last 40 merged PRs. Each push then costs two ubuntu-24.04 jobs of about 15 min (about 30 runner-minutes). Each run rebuilds a fixed historical commit (BEFORE_REF: b5c4249a) and replays 500 + 1,000 trials per mode. After merge, that measures only a frozen old binary against the PR. It will also go red for reasons unrelated to the PR:

  • MERE_REF is a second copy of ci.yml's pin. The next pin bump (or a mere >= raise in mere.toml) will leave this job building with an old compiler.
  • CASE_SHA256 in tools/corpus1074_replay.py hard-codes corpus 1074's hash. Any edit to that corpus file, which is itself in the trigger paths, fails with the original unchanged corpus input is required.
  • ruby-version: '4.0.10' is hard-coded rather than taken from REF_RUBY_VERSION.

My suggestion: drop the workflow and both corpus1074_replay*.py before merge. The evidence stays in the linked runs and artifacts. If you want to keep it, make it workflow_dispatch-only, with the before/after refs as inputs and the compiler pin read from ci.yml.

Minor

3. The root-cause control runs only in the diagnostic workflow (inline). tools/gc_candidate_kinds_check.py is a cheap source gate, under 1 min on one runner, and it is the only thing that pins the disjoint-range invariant. If the replay workflow goes away or becomes dispatch-only, the gate goes with it. Please wire it into ci.yml's build job next to tools/string_pages_check.py, which uses the same --compiler pattern. I checked that the extraction markers fail loudly when they are missing: they raise, so the gate cannot pass silently. One gap remains: the positive control checks only exit 0 and empty stderr. Also asserting the success line on stdout would catch a fixture whose checks stop running.

Suggestion

4. The aliasing problem is only fixed for Arrays. Objects, Strings, Hashes, Procs and Bindings are still numbered from handle_base. gc_mark_cand still tries every kind for each untyped candidate, so an Object candidate can still keep an unrelated Hash (gc_mark_wm k=3) or a String with the same number. The new comment in m_state.mere reads like the general rule. Please either say there that only Arrays are separated, or plan disjoint bases for the remaining kinds as a follow-up.

What I checked and found no problem with

  • Identity, both engines, index ON/OFF: object_id uniqueness, _id2ref round-trip before and after GC, equal?, compare_by_identity, Marshal links, cyclic inspect, each_object(Array) deltas, the GC.stat(:total_allocated_objects) delta, Array ivars, and an Array id held across a Fiber yield and GC. On the evaluator this matches Ruby 4.0.10 with and without GC_STRESS=20. On the VM it matches without stress. With VM + stress, the probe exceeds a 120 s bound on main and on this PR alike, so that is not a change.
  • Code paths: every handle_base use was audited for Array coupling (public_identity_id, the _id2ref inverse, gc_allocated_so_far, __store_counts/__store_done, gc_cand_hi, gc_live keys id*8+kind, ivar owner keys, C API keys, finalizer keys). Coroutine handles stay below 2^48, and capi_base (2^56) is still above the new range.
  • corpus/619: the new Array _id2ref checks are a faithful strengthening. They pass on Ruby 4.0.10, and on this PR with GC_STRESS=20 in all four modes.
  • Corpus and gates: sh run_corpus.sh --both: 1045/1045, index ON and OFF. tools/iseq/vm_corpus.sh -j 3: 1045 on the VM, 0 fallback, 0 FAIL. Corpus 1074 without stress: 50/50 per mode on both main and this PR (main does not reproduce on macOS). gc_candidate_kinds_check.py passes both controls at 4bdefa9c and all four at 599fcd29. Replay fault-injection checks: 6/6.
  • Instructions (median of 3, alternating, same compiler):
Benchmark main this PR Change
Array-heavy, evaluator 16,762M 16,779M +0.10%
Array-heavy, VM 19,631M 19,381M −1.27%
GC-heavy, evaluator 38,113M 38,102M −0.03%
GC-heavy, VM 38,744M 38,747M +0.01%
  • Peak footprint (MERE_RUBY_GC_TIGHT=1, fixed srand): Array-heavy evaluator 136.4 → 134.5 MB, VM 130.8 → 131.2 MB. GC-heavy VM 135.0 → 134.9 MB, but GC-heavy evaluator is 125.0 → 129.0 MB (+3.3%), the same across 4 seeds. RSS sampled through that run is lower on this PR at most points and after the final collection (109.9 vs 112.7 MB). The peak comes from a collection being triggered at a different moment: one extra GC in the Fiber phase, started on a larger heap. A Fiber-only variant goes the other way (105.8 → 98.5 MB). I am noting this, not counting it as a finding.
  • Base: the PR is based on b5c4249a, three merges behind main (3c58e049). Those merges change no workflow, tool or gate file, so the PR has every gate main has. It merges cleanly, and the merged tree passed both corpus runs above.

Not mergeable yet: #1 and #2 (Major) and #3 (Minor) are open.

Comment thread .github/workflows/corpus1074-replay.yml Resolved
Comment thread tools/corpus1074_replay.py Resolved
Comment thread tools/gc_candidate_kinds_check.py Resolved
Comment thread m_state.mere Resolved

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on the new review/discussion at current head 599fcd2983724cd07d4d6a2b4ad86f91242122c3, against freshly fetched main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e and prospective integration tree 8a1444ecb982a973fe7a2e5585af8c6edfafa643.

The existing Major VM/GC-stress finding remains blocking and is independently reproduced. On macOS arm64, alternating main and integration at the same absolute input filename and cwd, with MERE_RUBY_VM=1 and MERE_RUBY_GC_STRESS=20, the unchanged original corpus 1074 gives:

Hash index Main passes Integration passes
ON 20/20 10/20
OFF 20/20 6/20

All 24 integration failures exit 0, have empty stderr, print false first, and preserve every subsequent value output. Without stress, both builds pass 10/10 in each of the four engine/index modes (80/80 comparisons). These are additional observations supporting the existing finding, not a second inline report or a demonstrated root cause. Please fix or explain this controlled regression before merge, preserving the original program and bound.

Validation reused the previously recorded ordinary O2 main/integration binaries after byte comparisons of all 2,901/2,905 tracked entries against the freshly fetched trees: main has no differences; integration differs only in the replay workflow and three validation scripts. All 18 pinned mgz files match. The recorded builds use pinned Mere 72bb0d09 and mgz 661a01d8. Main/integration binary SHA-256: bf045d849726aa7ece634862ef31a21f8588632571a6a4bb4daf2e8e246c0850 / a1c05e13278fba2cf60f0b5261b1d6d58985f696896c0253922f71708f18ad2c. No new full runtime build is claimed.

The Array watermark fallback repair and targeted reader tests remain useful: all four O2 candidate-kind controls pass with the clean pinned compiler; replay fault-injection checks pass 6/6. Original corpus 1074 is byte-identical across main/head/integration (SHA-256 1370e3b38730e8a1ba600375c4eb1a11698ca8b069196be457ba95add420d6af). Whitespace checks pass; no tracked AGENTS.md or CLAUDE.md exists on base/head. The existing workflow/coverage feedback remains unaddressed in the current sources; existing threads are untouched.

Independently downloaded both artifacts from latest native replay 47034277107 and checked all 6,000 raw records, transcripts and per-mode counts. Repaired: 1,000/1,000 pass in each mode, 4,000/4,000 total. Historical VM/index-OFF: 5/500 retention failures; other historical modes: 0/500. No crash, diagnostic, invalid transcript or timeout; maximum recorded child time 0.2445 s. This successful non-stress replay does not cover the reproduced stress failure.

Core CI still has executing Linux/corpus jobs and incomplete downstream matrices, rather than only unassigned queues. All 27 latest-main CI jobs were inspected: 25 success, one skip, and Wasm failure after runner shutdown/exit 143. Historical failures and the recorded global merge holds remain preserved. No merge. COMMENT because this is the authenticated user's own PR.

@284km
284km marked this pull request as draft December 3, 2026 10:10

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review of 889044a4a26f859c317b4d72eacbcfcf25eb33ca against freshly fetched main 3c58e0494d2b28b3f7e1aa1211e7bd3dc678ec5e (integration tree cbb91a810801f8165c72e1ce4bd1c2025d29c160). No new actionable findings.

The replay-workflow Major, durable-CI/positive-output Minor, and Array-only documentation suggestion are addressed in the current sources:

  • The one-off workflow and both replay scripts are removed, with no remaining workflow/tool references.
  • The candidate-kind gate runs in the ordinary macOS corpus job and Linux build job, using their existing compiler setup and pin.
  • The positive control now requires its full success transcript, exit 0 and empty stderr. The comment explicitly limits the domain separation to Arrays.

Validation on macOS arm64: all four production-source fixture controls pass at ordinary O2 with the compiler executable from a clean checkout of pinned Mere 72bb0d0980f22c067c323695815c15bc20331898. A separate fault injection removing the fixture's success message is correctly rejected despite exit 0 and empty stderr. Parsed the CI YAML and verified exactly one gate in each intended job. Whitespace checks pass. No tracked AGENTS.md or CLAUDE.md exists on fetched base/head.

I recomputed the preceding reviewed head's integration with current main (tree 8a1444ecb982a973fe7a2e5585af8c6edfafa643). The complete tree comparison shows only the workflow/tool changes above and the explanatory comment change; runtime implementation, build inputs and corpus programs are unchanged. Original corpus 1074 retains SHA-256 1370e3b38730e8a1ba600375c4eb1a11698ca8b069196be457ba95add420d6af on base/head. No new full-runtime build, runtime repetition or platform/resource acceptance is claimed.

The existing Major/P2 VM + GC-stress finding remains blocking. Its runtime implementation has not changed, and the description correctly acknowledges that the attempted repair was rejected. The previous controlled main/integration comparison remains historical evidence for that unchanged implementation, not a new measurement in this review. Please retain the original program/bound and demonstrate the repair in that configuration before merging. The source fixture passing does not establish this end-to-end repair; no duplicate inline finding is added.

Exact-head CI still includes executing jobs, queued macOS work and incomplete downstream coverage; the new hosted gate steps were not yet completed when inspected. All 27 jobs of latest main CI were inspected: 25 success, one skip and the recorded Wasm failure. Existing global merge holds remain unchanged. This PR and every other open PR in the two watched repositories are drafts. No merge; COMMENT because this is the authenticated user's own PR.

This branch has not been deployed

No deployments
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