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
Node fails to synchronize blocks after a peer is randomly disconnected #6504
OS : Linux
JVM : Oracle Corporation 1.8.0_161 amd64
Version : 4.8.0
Expected behaviour
When the node has established multiple valid peer connections, it should be able to fetch block data from multiple available peers.
Even if a single peer is disconnected (including random disconnection), the node should automatically switch to other already connected peers to continue block synchronization, ensuring continuity and stability of the sync process.
Actual behaviour
During runtime, the following abnormal behavior was observed:
The node successfully establishes approximately 30 P2P connections.
However, during block synchronization, it appears that the node continuously requests blocks from only a single peer, while the other connections are not effectively utilized.
When this peer is disconnected by the random elimination strategy, the following log is printed:
After this connection is terminated, the node does not automatically resume block requests from other already connected peers. The block height stops updating, and the node enters a state where it can no longer continue block synchronization.
Based on logs and observed behavior:
There appears to be a strong single-peer dependency for block data syncing.
When the random elimination strategy is triggered, the only actively used peer is disconnected, which raises the question of whether there is an issue with the random elimination strategy.
Frequency
This issue is not consistently reproducible and was not clearly observed in earlier runs.
The current random disconnection strategy is relatively simple, the logic for “random disconnection” is as follows:
If the number of established peers is less than the configured maximum connections, return immediately.
Filter out trusted nodes.
If the number of peers in the broadcasting state ≥ 3, select one of the broadcasting peers using a “weighted random algorithm” and disconnect it.
Otherwise, randomly eliminate one peer from the syncing peers:
If needSyncFromPeerCount < 2, eliminate one peer from the needSyncFromUs nodes.
Otherwise, randomly eliminate one peer from all syncing peers.
Under this strategy, any node except trusted nodes has the potential to be disconnected. This is a good issue, and we can discuss how to optimize this strategy to minimize the disconnection of good connections.
@halibobo1205 The system introduced a “random disconnection” mechanism in its early design to automatically release resources when the maximum number of connections is reached. When the node’s connection pool is full, the system randomly selects an existing connection to disconnect, in order to maintain a certain level of connection churn within the pool. This strategy was originally intended to improve the overall connectivity and efficiency of the network.
@jakamobiii To avoid randomly disconnecting relatively good peers, a “last block received time” field can be added to the peer object. When applying the random disconnection strategy, the top N peers with the most recent “last block received time” are filtered out, and only the remaining peers participate in the random disconnection process.
@zeusoo001
As you mentioned that The node successfully establishes approximately 30 P2P connections., so what specific factors contribute to the node's single-peer dependency during block synchronization, and how can peer selection be improved for better load balancing?
@waynercheung Other peers may have modified the code logic. To fix this issue, please refer to the description above; it can be achieved by optimizing the random disconnection strategy.
This issue is included in the v4.8.2 release (ref: #6585). Development is currently in progress. We will continue to sync updates here as work advances. The fix is tentatively expected to be completed by May 2026.
Activity
zeusoo001 commentedon Jan 7, 2026
The current random disconnection strategy is relatively simple, the logic for “random disconnection” is as follows:
Under this strategy, any node except trusted nodes has the potential to be disconnected. This is a good issue, and we can discuss how to optimize this strategy to minimize the disconnection of good connections.
halibobo1205 commentedon Jan 12, 2026
@zeusoo001 What was the rationale behind the original design of
RANDOM_ELIMINATION?zeusoo001 commentedon Jan 12, 2026
@halibobo1205 The system introduced a “random disconnection” mechanism in its early design to automatically release resources when the maximum number of connections is reached. When the node’s connection pool is full, the system randomly selects an existing connection to disconnect, in order to maintain a certain level of connection churn within the pool. This strategy was originally intended to improve the overall connectivity and efficiency of the network.
jakamobiii commentedon Jan 15, 2026
@zeusoo001 Are there any good optimization solutions for the random disconnection strategy?
zeusoo001 commentedon Jan 15, 2026
@jakamobiii To avoid randomly disconnecting relatively good peers, a “last block received time” field can be added to the peer object. When applying the random disconnection strategy, the top N peers with the most recent “last block received time” are filtered out, and only the remaining peers participate in the random disconnection process.
waynercheung commentedon Jan 15, 2026
@zeusoo001
As you mentioned that
The node successfully establishes approximately 30 P2P connections., so what specific factors contribute to the node's single-peer dependency during block synchronization, and how can peer selection be improved for better load balancing?zeusoo001 commentedon Jan 26, 2026
@waynercheung Other peers may have modified the code logic. To fix this issue, please refer to the description above; it can be achieved by optimizing the random disconnection strategy.
zeusoo001 commentedon Mar 24, 2026
This issue is included in the v4.8.2 release (ref: #6585). Development is currently in progress. We will continue to sync updates here as work advances. The fix is tentatively expected to be completed by May 2026.