Skip to content

No-pending-messages debug_assert is likely race-y #4437

@tnull

Description

@tnull

In 47a3e5c we introduced a debug_assert checking that we don't have any pending messages in PersistenceNotifierGuard::optionally_notify. However, this seems to be race-y, as I just hit this debug_assert:

[2026-02-24T09:50:11.997Z DEBUG lightning::ln::peer_handler:1884] Finished noise handshake for connection (p:02465e)
[2026-02-24T09:50:11.998Z INFO  lightning::ln::peer_handler:2140] Received Init message: DataLossProtect: required, InitialRoutingSync: not supported, UpfrontShutdownScript: supported, GossipQueries: supported, VariableLengthOnion: required, StaticRemoteKey: required, PaymentSecret: required,
BasicMPP: supported, Wumbo: supported, AnchorsNonzeroFeeHtlcTx: not supported, AnchorsZeroFeeHtlcTx: supported, RouteBlinding: supported, ShutdownAnySegwit: supported, DualFund: not supported, Taproot: supported, Quiescence: supported, OnionMessages: supported, ProvideStorage: not supported, C
hannelType: supported, SCIDPrivacy: supported, ZeroConf: not supported, Trampoline: not supported, SimpleClose: supported, Splice: not supported, AnchorZeroFeeCommitmentsStaging: not supported, HtlcHold: not supported, unknown flags: supported (p:02465e)

thread 'tokio-runtime-worker' panicked at /home/tnull/.cargo/git/checkouts/rust-lightning-e47a539aa5104a91/b6c17c5/lightning/src/ln/channelmanager.rs:14624:7:
assertion failed: peer_state.pending_msg_events.is_empty()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions