You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dash-spv: the peer reader can block forever writing a ping or a pong #1238
All paths are under dash-spv/src/ at 8dde9d0c (dev after #902).
The keepalive ping write (network/peer.rs:463) and the pong write (network/peer.rs:491-498) run after the reader's select! has resolved, with no WRITE_TIMEOUT, so the cancellation token is no longer polled. The writer is an Arc<Mutex<OwnedWriteHalf>> shared with PeerHandle::send, and the parked reader holds the lock. A kick or close() only cancels the token, so the reader task keeps the socket open, Disconnected is never sent, and every send to that peer times out on the lock.
Evidence. A throwaway test with a fake loopback peer that completes the handshake, floods pings and never reads:
fake peer has written 2162688 bytes of pings, reader read 565229
after close(): reader ended = false within 5.001496s
after the remote closes its socket: reader ended = true within 1.001084ms
Against an honest dashd the leak ends after Core's own inactivity timeout (about 20 minutes). A peer that keeps the connection open on purpose makes it permanent.
Fix. Put both writes under the same WRITE_TIMEOUT as PeerHandle::send, or race them against the token.
Activity