Skip to content

net: reactor never parks on mempool inner - #320

Merged
reardencode merged 5 commits into
masterfrom
net/reactor-inner-never
Sep 4, 2026
Merged

net: reactor never parks on mempool inner#320
reardencode merged 5 commits into
masterfrom
net/reactor-inner-never

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Why

PID 4026939 (tip-follow, ~10h): tokio reactor parked in inner lock_slow while blocking-pool accept held write across Query. Last tip: perf then 7.5h silence. #316 moved accept_tx off the reactor; INV/getdata still inner.read(), and commit/promote still Query under write.

What

  • Short write: commit_after_script / park_orphan are graph-only. Hub promote, package, reorg strip, and evict_after_reorg drop write before Query/scripts.
  • Reactor try_read: session INV / getdata / compact never park. Busy write skips that item (re-getdata / notfound / reconstruct without those txs).
  • Compact fill: siphash live txid/wtxid, clone matching bodies only. No list_live() of the whole mempool.
  • No per-accept presence CoW and no per-getdata spawn_blocking.
  • Blocking inner read/write asserts not-reactor.
  • Dropping a tip-accept join detaches (does not condvar-wait on the worker).

Lock facts live only in docs/concurrency.md.

Test plan

  • cargo test -p rbitcoin-mempool --lib
  • cargo test -p rbitcoin-net --lib
    (pins: Query not under write, try_contains on worker, blocking contains panics on worker, compact list_live=0, JoinOnDrop detach)

Do not merge unless asked.

commit_after_script re-checks from PreparedAdmit.chain_coins and the
graph. park_orphan treats any non-mempool input as missing. Hub write
locks can now cover graph mutation without Query IO.
Session INV/getdata/compact use try_read (busy write skips that item).
Accept, package, orphan promote, and reorg strip drop the write lock
before Query/scripts. Compact fill siphashes live ids and clones
matching bodies only. Blocking inner read/write asserts not-reactor.
JoinOnDrop no longer condvar-waits on the tokio worker. tip-accept
still runs the job; a cancelled peer does not need the result.
concurrency.md owns the lock/role facts. CHANGELOG Unreleased notes
the freeze-class fix.
spawn_blocking threads are named tokio-rt-worker. WS announce frames
called get_tx without BlockingRegion and tripped the inner-read assert.
Mempool /fee-estimates HTTP now uses the same spawn_join path. Electrum
scripthash restatus already spawned blocking; it now enters the region.
@reardencode
reardencode merged commit 213fcfa into master Sep 4, 2026
13 checks passed
@rearden-grok
rearden-grok Bot deleted the net/reactor-inner-never branch September 4, 2026 15:09
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