Skip to content

v4.4: poh: cache start bank fields so pruned banks are freed (backport of #16302) - #16312

Merged
bw-solana merged 1 commit into
v4.4from
mergify/bp/v4.4/pr-16302
Oct 23, 2026
Merged

bw-solana merged 1 commit into
v4.4from
mergify/bp/v4.4/pr-16302

Conversation

@mergify

@mergify mergify Bot commented Oct 22, 2026

Copy link
Copy Markdown

Problem

PohRecorder holds a strong reference to its start bank. Under Alpenglow, PoH is reset only when our leader window starts, so between windows PoH keeps our last leader bank alive after BankForks prunes it:

  • The bank and its stake cache stay in memory until our next window, which can be hours away for a low-stake leader. After an epoch boundary this is a full extra copy of the stake map, about 1 GiB on mainnet.
  • The next window-start reset drops this old bank on the block creation loop thread, under the PoH write lock.

Summary of Changes

PoH no longer holds its start bank. It caches the slot, bank id, ns_per_slot and leader id it reads, so the bank is freed when BankForks prunes it, like any other bank.

Testing

  • New test_poh_recorder_does_not_keep_start_bank_alive covers both places that set the start bank: a completed working bank and a reset. It fails on the old code.
  • cargo test -p solana-poh and cargo test -p solana-core --lib block_creation_loop pass.

This is an automatic backport of pull request #16302 done by [Mergify](https://mergify.com).

@mergify
mergify Bot requested a review from a team as a code owner October 22, 2026 19:58

@AshwinSekar AshwinSekar 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.

approving as SME, mechanical change to only keep the fields from the bank that Tower needs

this allows the bank to be async dropped during root cleanup, rather than holding onto it till the next leader window and performing a sync drop during leader's build time

@bw-solana

Copy link
Copy Markdown

@Mergifyio rebase

* poh: hold start bank weakly so pruned banks are freed

PohRecorder held a strong reference to its start bank. Under Alpenglow,
PoH is reset only when our leader window starts, so between windows it
kept our last leader bank alive after BankForks pruned it. The next
window-start reset then dropped that bank on the block creation loop
thread, under the PoH write lock.

Hold the start bank as Weak<Bank>, and cache the slot, bank id and
ns_per_slot that PoH reads after the bank can be gone.

* poh: cache start bank leader id instead of holding the bank weakly

Upgrading the Weak in start_slot_was_mine can briefly make PoH the last
holder of the start bank, so the bank could still be dropped under the
PoH lock. Cache the leader id like the other start bank fields and drop
the Weak.

(cherry picked from commit 40dcf1d)
@mergify

mergify Bot commented Oct 23, 2026

Copy link
Copy Markdown
Author

rebase

✅ Branch has been successfully rebased

@bw-solana
bw-solana force-pushed the mergify/bp/v4.4/pr-16302 branch from 5aadce8 to 680ced6 Compare October 23, 2026 01:54
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.4%. Comparing base (0e5ba18) to head (680ced6).
⚠️ Report is 2 commits behind head on v4.4.

Additional details and impacted files
@@            Coverage Diff            @@
##             v4.4   #16312     +/-   ##
=========================================
- Coverage    82.4%    82.4%   -0.1%     
=========================================
  Files         934      934             
  Lines      372236   372297     +61     
=========================================
+ Hits       306946   306991     +45     
- Misses      65290    65306     +16     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bw-solana
bw-solana merged commit c4ca46b into v4.4 Oct 23, 2026
44 checks passed
@bw-solana
bw-solana deleted the mergify/bp/v4.4/pr-16302 branch October 23, 2026 03:00
@apfitzge

apfitzge commented Oct 23, 2026 •

Copy link
Copy Markdown

nvm don't rebase. this is deleted. didn't see any github updates until after the comment posted

@mergify

mergify Bot commented Oct 23, 2026

Copy link
Copy Markdown
Author

rebase

☑️ Nothing to do, the required conditions are not met

Details
  • -closed [📌 rebase requirement]
  • any of:
    • #commits-behind > 0 [📌 rebase requirement]
    • -linear-history [📌 rebase requirement]
  • -conflict [📌 rebase requirement]
  • queue-position = -1 [📌 rebase requirement]

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.

5 participants