Skip to content

Fix two flakes in the HeapCap heap-limit test - #53

Merged
Project516 merged 1 commit into
masterfrom
p516/heapcap-test
Nov 5, 2026
Merged

Project516 merged 1 commit into
masterfrom
p516/heapcap-test

Conversation

@Project516

Copy link
Copy Markdown
Owner

Fixes HeapCap, which #50 added and which fails some CI runs (it failed #51's test check on x64).

Two separate flakes:

  • HotSpot side: the program printed the error while its list still held the full 32 MB heap, and building that message string allocates. On GitHub's x64 runners HotSpot sometimes threw a second OutOfMemoryError there, so the expected output changed. The program now clears the list before printing. Three HotSpot runs here give the same output each time.
  • java-web side: about 1 run in 5 here threw a false OutOfMemoryError on the allocations after the list was cleared. The check collects and measures again before throwing, but Node frees array buffers after a collection rather than during it, so arrayBuffers read right after gc() can still count arrays that are already garbage. The VM now throws only when two checks in a row are over the cap. A heap that really is full still throws, one check step (at least 4 MB of allocation) later; a stale reading clears by the next check.

Checks: node src/node.ts -Xmx32m HeapCap passed 12 runs out of 12 here (it failed 1 in 5 before), and pnpm typecheck passes.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: dc1a453c-badd-4348-a780-c0da2fcec874
Commits

Reviewing files that changed from the base of the PR and between 4ec0fa6 and fa3fc58.

Files selected for processing: 2

  • src/runtime.ts
  • test/java/HeapCap.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@project516-review-bot project516-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR fixes two flakes in the HeapCap test. In runtime.ts, the allocation check now requires two consecutive over-cap readings before throwing OOM, addressing a Node.js quirk where array buffers are freed after GC rather than during it. In HeapCap.java, the caught OOM handler clears the heap-retaining list before printing the error message, preventing a second OOM during string allocation. Both changes are targeted and correct.


review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict approve

@Project516
Project516 merged commit cac6f05 into master Nov 5, 2026
16 checks passed
@Project516
Project516 deleted the p516/heapcap-test branch November 5, 2026 19:55
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