Skip to content

test: fix flaky memory_bytes check in 05_stats.t - #3

Merged
manuelnaranjo merged 1 commit into
masterfrom
fix/flaky-stats-test
Oct 22, 2026
Merged

manuelnaranjo merged 1 commit into
masterfrom
fix/flaky-stats-test

Conversation

@manuelnaranjo

Copy link
Copy Markdown
Member

Summary

t/05_stats.t failed intermittently (2/20 runs on perl 5.36, 5/20 on perl 5.42) on the assertion memory_bytes >= 0.

memory_bytes is the change in process memory size (VmSize from /proc/self/statm) across an eval. It is legitimately negative whenever V8 releases
memory during the eval; failing runs showed values such as -490668, with no NaN/undef values. The test now checks that memory_bytes is a number;
elapsed_us keeps the >= 0 check.

Testing

  • Before: 24 test files × 20 runs on perl 5.36.3 and 5.42.3 (official Docker images); 05_stats.t was the only failure.
  • After: 05_stats.t × 50 runs on each perl, 0 failures.

Follow-up

V8Context.cc:47 initializes pagesize_bytes with total_memory_pages() (the page count) instead of the system page size, so memory_bytes is scaled
by the wrong factor. Left for a separate change since it alters the values get_stats() reports.

🤖 Generated with Claude Code

memory_bytes is the change in process memory size (VmSize from
/proc/self/statm) across an eval. It is negative whenever V8 unmaps
memory during the eval, so asserting memory_bytes >= 0 failed in
roughly 5-25% of runs. Check that it is a number instead; elapsed_us
keeps the >= 0 check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manuelnaranjo
manuelnaranjo merged commit 46853ec into master Oct 22, 2026
3 checks passed
@manuelnaranjo
manuelnaranjo deleted the fix/flaky-stats-test branch October 22, 2026 11:44
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