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

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

opened this

Merged 3h 48m ago, live in production

This makes the snapshot stream pass collect its garbage more often. I can't measure whether that is the whole cause, and I never saw the pass's memory on production's data. Why this pass.

Notes

opened this

This makes the snapshot stream pass collect its garbage more often. I can't measure whether that is the whole cause, and I never saw the pass's memory on production's data.

Why this pass. snapshot-stream was open across the trip again. The main heap rose 465 → 1393 MiB and fell back to 604 MiB, which is garbage, not a leak. The memory outside every heap rose 845 → 2417 MiB and fell back to 891 MiB, with every held count flat. The main heap is better than the finding after #17558, where it reached 2655 MiB afterwards.

What changed.

  • The pass in src/snapshot/snapshot.ts now asks for a collection each 64 MiB of plain bytes it sends. It was 256 MiB.
  • settler in src/snapshot/settle.ts now runs a full collection 128 MiB above the last one. It was 512 MiB.
  • The pile a pass can leave between collections is about a quarter of what it was.
  • docs/features/memory-growth.md has a new paragraph (#17760).

Test. test/snapshot-settle.test.ts has a new case: the default settler stays quiet at 127 MiB over and runs a full collection at 128 MiB. bun test test/snapshot-settle.test.ts test/snapshot-stream.test.ts passes, tsc --noEmit is clean and gate.ts is clean.

Not done.

  • I did not test the 64 MiB pass interval, because that needs 64 MiB of real chunks. Only the 128 MiB full-collection threshold has a test.
  • I did not touch verify-sweep, which was also open at the trip. It runs every 10 minutes and its timing looks coincidental.
  • The cost is more frequent full collections while a pass sends changed data. Each holds the loop for a short while on a heap of a few hundred MiB.
  • The next finding's memory outside every heap line at the trip will say whether this was enough.

To try it. After a release, read memory-growth on /system for a day. Success is it staying out of the degraded list, or holding under 10 minutes.

🤖 Generated with Claude Code

Closes #17760

commented

This makes the snapshot stream pass collect its garbage more often. I can't measure whether that is the whole cause, and I never saw the pass's memory on production's data.

Why this pass. snapshot-stream was open across the trip again. The main heap rose 465 → 1393 MiB and fell back to 604 MiB, which is garbage, not a leak. The memory outside every heap rose 845 → 2417 MiB and fell back to 891 MiB, with every held count flat. The main heap is better than the finding after #17558, where it reached 2655 MiB afterwards.

What changed.

  • The pass in src/snapshot/snapshot.ts now asks for a collection each 64 MiB of plain bytes it sends. It was 256 MiB.
  • settler in src/snapshot/settle.ts now runs a full collection 128 MiB above the last one. It was 512 MiB.
  • The pile a pass can leave between collections is about a quarter of what it was.
  • docs/features/memory-growth.md has a new paragraph (#17760).

Test. test/snapshot-settle.test.ts has a new case: the default settler stays quiet at 127 MiB over and runs a full collection at 128 MiB. bun test test/snapshot-settle.test.ts test/snapshot-stream.test.ts passes, tsc --noEmit is clean and gate.ts is clean.

Not done.

  • I did not test the 64 MiB pass interval, because that needs 64 MiB of real chunks. Only the 128 MiB full-collection threshold has a test.
  • I did not touch verify-sweep, which was also open at the trip. It runs every 10 minutes and its timing looks coincidental.
  • The cost is more frequent full collections while a pass sends changed data. Each holds the loop for a short while on a heap of a few hundred MiB.
  • The next finding's memory outside every heap line at the trip will say whether this was enough.

To try it. After a release, read memory-growth on /system for a day. Success is it staying out of the degraded list, or holding under 10 minutes.

🤖 Generated with Claude Code

commented

This pull makes the snapshot stream pass collect its garbage more often, and both thresholds it changes are now pinned by tests. The effect on production memory is still unmeasured.

What changed

  • The pass in src/snapshot/snapshot.ts asks for a collection each 64 MiB of plain bytes sent (was 256 MiB).
  • settler in src/snapshot/settle.ts runs a full collection 128 MiB above the last one (was 512 MiB).
  • docs/features/memory-growth.md has a paragraph on it (#17760). It says the effect is not measured on production data.

What the review asked for

  • Pass interval test. test/snapshot-stream.test.ts now runs a real pass with settleBytes unset over an 80 MiB random blob in the hosted forge's database. It asserts settle ran at least once and fewer than three times. I reverted the constant to 256 MiB and the test failed. Nothing is exported from src/, because tests do not count as callers for the unused-export rule.
  • Threshold test. test/snapshot-settle.test.ts now calls settler() with no seams and drives it through held.read and Bun.gc. It stays quiet at 127 MiB over and runs a full collection at 128 MiB. The test title says so.

Checks. test/snapshot-settle.test.ts and test/snapshot-stream.test.ts pass (17 tests), tsc --noEmit is clean and gate.ts --fix is clean.

Not done

  • I did not touch verify-sweep, which was also open at the trip. Its timing looks coincidental.
  • More frequent full collections hold the loop a little longer while a pass sends changed data.

To try it. After a release, watch memory-growth on /system for a day. The goal is that it stays out of the degraded list or holds under 10 minutes. If it still trips, the next finding's memory outside every heap line at the trip will show whether this was enough.

🤖 Generated with Claude Code

Sign in to join this conversation.

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

Keyboard shortcuts

Docs