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
fix: fix SnapSync regression from network layer refactor (#10753)
Fix four issues introduced in #10753 that caused SnapSync to regress
from 25% in 5 minutes to 1% in 15 minutes on Hoodi:
1. Session.Handshake: only disconnect on NodeId mismatch for static/bootnode
peers (operator-verified identities). Discovered peers accept the new
identity as before — stale discovery data is common and benign. Also
fix HandshakeComplete firing after InitiateDisconnect on doomed sessions.
2. PeerManager: stop EnsureAvailableActivePeerSlotAsync from consuming
SemaphoreSlim signals meant for the main peer update loop. Use
Task.Delay for polling instead of WaitAsync on the shared semaphore.
3. PeerManager: reduce _sessionLock scope in OnDisconnected and
OnHandshakeComplete to only guard session bookkeeping. Peer processing
runs outside the lock to avoid serializing all session events.
4. PeerManager: restore dedicated thread for peer update loop via
Task.Factory.StartNew(LongRunning) with .Unwrap() — fixes the
original Task<Task> bug while keeping the loop off the thread pool.
@@ -358,7 +359,7 @@ public void Handshake(PublicKey? handshakeRemoteNodeId)
358
359
voidTraceHandshakeCalled()=>_logger.Trace($"{nameof(Handshake)} called on {this}");
359
360
360
361
[MethodImpl(MethodImplOptions.NoInlining)]
361
-
voidDebugUnexpectedNodeId(PublicKeyremoteNodeId)=>_logger.Debug($"Unexpected remote node id in handshake: expected {RemoteNodeId}, received {remoteNodeId}");
362
+
voidDebugUnexpectedNodeId(PublicKeyremoteNodeId)=>_logger.Debug($"Unexpected remote node id in handshake with static/bootnode peer: expected {RemoteNodeId}, received {remoteNodeId}");
362
363
363
364
[MethodImpl(MethodImplOptions.NoInlining)]
364
365
voidTraceDifferentNodeId(PublicKeyremoteNodeId)=>_logger.Trace($"Different NodeId received in handshake: old: {RemoteNodeId}, new: {remoteNodeId}");
0 commit comments