Repository navigation
fix(transport,core,node): harden transition_gate re-entrancy, bounded mail/provider shutdown, and async lock hygiene (#1231) - #1248
Conversation
|
Reviewed commit
The broader review covered poll-scoped reentrancy detection, bounded per-peer outboxes, cancellation accounting, stop-token races, lock ordering, and persistence serialization. Existing targeted extension/mail/evidence/processor-close tests passed 102/102; the additional cancellation regression failed as described above. Integration: pairwise merge checks found textual conflicts with #1239 in |
…down, and async locks (#1231) - Detect same-task re-entry into Runner::transition_gate via poll-scoped active-runner tracking (native + wasm32) so re-entrant Scope::inject fails fast instead of self-deadlocking - Decouple JsShell outbound network sends from transition_gate via bounded per-peer FIFO OverlayOutbox spawned onto NodeTasks - Race Recipient::poll and Recipient::run against StopToken and per-poll timeout, and bound Provider::close / Processor::close shutdown drain phases when storage or network stalls - Add SlowLockGuard wait/hold observability and narrow DhtRegistrationPublisher::held and PeriodicMeasure evidence query lock scopes while preserving lock-order invariants - Drain and invoke Notifier::wake wakers outside NotifierState mutex
… report store-release timeout
b7b9d81 to
190ec33
Compare
Summary
Closes #1231.
transition_gatere-entrancy self-deadlock (crates/node/src/extension/ext/registry.rs):ACTIVE_RUNNERS) across native andwasm32so same-task re-entrantScope::inject/Route::dispatch/Route::observe_linkfails fast withError::ExtensionErrorinstead of deadlocking ontransition_gate.JsShellnetwork sends fromtransition_gate(extension/protocols/{outbox.rs,js.rs}):OverlayOutbox(PeerQuota+ per-peer drain workers onNodeTasks) soJsShell::runenqueues outbound payloads without awaiting network I/O undertransition_gate.Recipientshutdown &Provider::closetask draining (mail/recipient.rs,provider/mod.rs):Recipient::pollagainst bothStopTokens andDEFAULT_MAIL_POLL_TIMEOUT(30s), and boundsProvider::closephases withCLOSE_DRAIN_TIMEOUT(5s) + structured warnings so shutdown resolves within bounded time even when storage/network stalls.slow_lock.rs,registration.rs,measure.rs,dns-relay/src/recall/mod.rs):SlowLockGuard(500msthreshold + metrics) and narrows lock scopes inDhtRegistrationPublisher::publish_leaseandPeriodicMeasureread paths.Notifier::wakewaker invocation outside the mutex (crates/transport/src/notifier.rs).Test Plan
cargo test -p rings-transport --lib notifier(7 passed)cargo test -p rings-node --lib extension::(73 passed)cargo test -p rings-node --lib mail::(18 passed) &test_close(7 passed)cargo clippy -p rings-transport -p rings-core -p rings-dns-relay -p rings-node --lib --tests -- -D warningscargo check -p rings-node --lib --target wasm32-unknown-unknown --no-default-features --features browser