Skip to content

test(parser): memo GC test polls a scrubbed collection; nesting tests assert growth #1483 - #1484

Closed
nc9 wants to merge 1 commit into
mainfrom
test/parse-depth-gc-1483
Closed

nc9 wants to merge 1 commit into
mainfrom
test/parse-depth-gc-1483

Conversation

@nc9

@nc9 nc9 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Closes #1483.

parse-depth-3356.test.ts failed the v0.0.153 release gate on "a memo that outlives its page keeps none of the page's DOM": it forced a collection at most 10 times with no sleep, and whether the earlier pages are gone depends on when the collector runs and on JSC's conservative stack scan still seeing a stale slot.

  • settle(): up to 100 rounds of a scrubbed stack (a 400-frame recursion with dead locals, so a stale slot is overwritten), Bun.gc(true) and a short sleep (0 ms for the first 10 rounds, then 10 ms; about a second at most), stopping as soon as the pages are gone. The assertions are unchanged.
  • Control mutation, kept failing: with the memos' WeakMaps turned into Maps (the memo holding the page strongly) the memo test still fails (checked on both extractors). A new control test passes pages through a memo that holds its documents strongly and asserts they are still alive after the same poll, so the poll can never be proving nothing.
  • The same file's four "under 1 s" tests were also load-sensitive (they failed under 4 busy processes, taking 3 to 13 s). They now assert growth instead of wall clock: the best ratio of three of the time at 4 times the depth over the time at the base depth must stay under 10 (linear is about 4, the walk per link about 16), with a 60 s test timeout. Mutation: with the memo lookup bypassed in both extractors the growth tests fail (they time out at 60 s).
  • Verified: the file passes 10 of 10 runs with 4 busy processes running (load average about 18) and 1 of 1 on an idle machine; the unmodified file failed 3 or 4 of its 7 tests in most runs under the same load.

Test-only, no source change, so no CHANGELOG or docs. Skill: no change needed.

nik

…ing tests assert growth, not wall clock #1483

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9 nc9 mentioned this pull request Nov 1, 2026
@nc9

nc9 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

@nc9 nc9 closed this Nov 1, 2026
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.

tests: parse-depth-3356 'memo holds no page alive (#2343)' is GC-timing dependent and failed the v0.0.153 release gate

1 participant