Public: anyone can read this; the crew can change it.

Sentinel: memory-growth was degraded 16 minutes today: The forge's own memory is 4769 MiB, over twice its first-hour 1716 MiB and past the 2176 MiB more its database caches m… #17494

opened this

Merged 21h 1m ago, live in production

A snapshot now collects garbage every 256 MiB of plain bytes it reads, not once per hosted forge. This is my best reading of the cause, not a measured one. I did not check it against production's data.

Notes

opened this

A snapshot now collects garbage every 256 MiB of plain bytes it reads, not once per hosted forge. This is my best reading of the cause, not a measured one. I did not check it against production's data.

Why this and not something else. At the trip the main heap was 2855 MiB, against 416 MiB in the first hour and 462 MiB now. It fell back, so it was garbage rather than a leak, and every held count was flat. snapshot-stream was open before the growth began. The last fix (#17434) collected once after each forge's pass, but one multi-GiB forge still cuts all its chunks through fresh buffers before that collection runs. verify-sweep is only listed as running at the trip. Nothing in the evidence points at it.

What changed

  • src/snapshot/snapshot.ts: takeSnapshot calls settle (Bun.gc(false)) each time settleBytes (default 256 MiB) more plain bytes have been read. Both are test seams on Snapshotter. The nightly snapshot takes the same path, so it collects the same way.
  • test/snapshot-stream.test.ts: the new test fails without the change.
    • With settleBytes: 1, settle runs.
    • With settleBytes: 2 ** 40, it never runs.
  • docs/features/memory-growth.md: a paragraph recording the change.

The snapshot test files other than test/snapshot-stream.test.ts (which passes, 11 of 11) had one failure in my first run that I never identified. That run included my own test failing on a 1 << 40 shift bug, which I fixed and re-ran only in test/snapshot-stream.test.ts. The full suite was not run here; the forge's check runs it. bun x tsc --noEmit was clean, and scripts/gate.ts --fix changed nothing.

What I chose not to do

  • No change to the finding's evidence lines or the sentinel.
  • No page or terminal change, so the commit says "No door".
  • I found nothing in verify-sweep to change.

How to check. The next memory-growth finding's memory heap main line at the trip shows whether this was the whole cause. If snapshot-stream is still open then with the heap high, the next place to look is the chunk packing in packChunk.

🤖 Generated with Claude Code

Closes #17493

commented

A snapshot now collects garbage every 256 MiB of plain bytes it reads, not once per hosted forge. This is my best reading of the cause, not a measured one. I did not check it against production's data.

Why this and not something else. At the trip the main heap was 2855 MiB, against 416 MiB in the first hour and 462 MiB now. It fell back, so it was garbage rather than a leak, and every held count was flat. snapshot-stream was open before the growth began. The last fix (#17434) collected once after each forge's pass, but one multi-GiB forge still cuts all its chunks through fresh buffers before that collection runs. verify-sweep is only listed as running at the trip. Nothing in the evidence points at it.

What changed

  • src/snapshot/snapshot.ts: takeSnapshot calls settle (Bun.gc(false)) each time settleBytes (default 256 MiB) more plain bytes have been read. Both are test seams on Snapshotter. The nightly snapshot takes the same path, so it collects the same way.
  • test/snapshot-stream.test.ts: the new test fails without the change.
    • With settleBytes: 1, settle runs.
    • With settleBytes: 2 ** 40, it never runs.
  • docs/features/memory-growth.md: a paragraph recording the change.

The snapshot test files other than test/snapshot-stream.test.ts (which passes, 11 of 11) had one failure in my first run that I never identified. That run included my own test failing on a 1 << 40 shift bug, which I fixed and re-ran only in test/snapshot-stream.test.ts. The full suite was not run here; the forge's check runs it. bun x tsc --noEmit was clean, and scripts/gate.ts --fix changed nothing.

What I chose not to do

  • No change to the finding's evidence lines or the sentinel.
  • No page or terminal change, so the commit says "No door".
  • I found nothing in verify-sweep to change.

How to check. The next memory-growth finding's memory heap main line at the trip shows whether this was the whole cause. If snapshot-stream is still open then with the heap high, the next place to look is the chunk packing in packChunk.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs