Skip to content

Commit a6bdc47

Browse files
authored
Log range sync download errors (#6991)
Currently range sync download log errors just say `error: rpc_error` which isn't helpful. The actual error is suppressed unless logged somewhere else. Log the actual error that caused the batch download to fail as part of the log that states that the batch download failed.
1 parent d60c24e commit a6bdc47

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

beacon_node/network/src/sync/backfill_sync/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
1111
use crate::network_beacon_processor::ChainSegmentProcessId;
1212
use crate::sync::manager::BatchProcessResult;
13-
use crate::sync::network_context::RangeRequestId;
14-
use crate::sync::network_context::SyncNetworkContext;
13+
use crate::sync::network_context::{RangeRequestId, RpcResponseError, SyncNetworkContext};
1514
use crate::sync::range_sync::{
1615
BatchConfig, BatchId, BatchInfo, BatchOperationOutcome, BatchProcessingResult, BatchState,
1716
};
@@ -375,6 +374,7 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
375374
batch_id: BatchId,
376375
peer_id: &PeerId,
377376
request_id: Id,
377+
err: RpcResponseError,
378378
) -> Result<(), BackFillError> {
379379
if let Some(batch) = self.batches.get_mut(&batch_id) {
380380
// A batch could be retried without the peer failing the request (disconnecting/
@@ -385,7 +385,7 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
385385
if !batch.is_expecting_block(&request_id) {
386386
return Ok(());
387387
}
388-
debug!(batch_epoch = %batch_id, error = "rpc_error", "Batch failed");
388+
debug!(batch_epoch = %batch_id, error = ?err, "Batch download failed");
389389
if let Some(active_requests) = self.active_requests.get_mut(peer_id) {
390390
active_requests.remove(&batch_id);
391391
}

beacon_node/network/src/sync/manager.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,24 +1288,30 @@ impl<T: BeaconChainTypes> SyncManager<T> {
12881288
}
12891289
}
12901290
}
1291-
Err(_) => match range_request_id.requester {
1291+
Err(e) => match range_request_id.requester {
12921292
RangeRequestId::RangeSync { chain_id, batch_id } => {
12931293
self.range_sync.inject_error(
12941294
&mut self.network,
12951295
peer_id,
12961296
batch_id,
12971297
chain_id,
12981298
range_request_id.id,
1299+
e,
12991300
);
13001301
self.update_sync_state();
13011302
}
1302-
RangeRequestId::BackfillSync { batch_id } => match self
1303-
.backfill_sync
1304-
.inject_error(&mut self.network, batch_id, &peer_id, range_request_id.id)
1305-
{
1306-
Ok(_) => {}
1307-
Err(_) => self.update_sync_state(),
1308-
},
1303+
RangeRequestId::BackfillSync { batch_id } => {
1304+
match self.backfill_sync.inject_error(
1305+
&mut self.network,
1306+
batch_id,
1307+
&peer_id,
1308+
range_request_id.id,
1309+
e,
1310+
) {
1311+
Ok(_) => {}
1312+
Err(_) => self.update_sync_state(),
1313+
}
1314+
}
13091315
},
13101316
}
13111317
}

beacon_node/network/src/sync/range_sync/chain.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::batch::{BatchInfo, BatchProcessingResult, BatchState};
22
use super::RangeSyncType;
33
use crate::metrics;
44
use crate::network_beacon_processor::ChainSegmentProcessId;
5-
use crate::sync::network_context::RangeRequestId;
5+
use crate::sync::network_context::{RangeRequestId, RpcResponseError};
66
use crate::sync::{network_context::SyncNetworkContext, BatchOperationOutcome, BatchProcessResult};
77
use beacon_chain::block_verification_types::RpcBlock;
88
use beacon_chain::BeaconChainTypes;
@@ -879,6 +879,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
879879
batch_id: BatchId,
880880
peer_id: &PeerId,
881881
request_id: Id,
882+
err: RpcResponseError,
882883
) -> ProcessingResult {
883884
let batch_state = self.visualize_batch_state();
884885
if let Some(batch) = self.batches.get_mut(&batch_id) {
@@ -901,9 +902,10 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
901902
debug!(
902903
batch_epoch = %batch_id,
903904
batch_state = ?batch.state(),
905+
error = ?err,
904906
%peer_id,
905907
%request_id,
906-
"Batch failed. RPC Error"
908+
"Batch download error"
907909
);
908910
if let Some(active_requests) = self.peers.get_mut(peer_id) {
909911
active_requests.remove(&batch_id);

beacon_node/network/src/sync/range_sync/range.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use super::chain_collection::{ChainCollection, SyncChainStatus};
4444
use super::sync_type::RangeSyncType;
4545
use crate::metrics;
4646
use crate::status::ToStatusMessage;
47-
use crate::sync::network_context::SyncNetworkContext;
47+
use crate::sync::network_context::{RpcResponseError, SyncNetworkContext};
4848
use crate::sync::BatchProcessResult;
4949
use beacon_chain::block_verification_types::RpcBlock;
5050
use beacon_chain::{BeaconChain, BeaconChainTypes};
@@ -348,10 +348,11 @@ where
348348
batch_id: BatchId,
349349
chain_id: ChainId,
350350
request_id: Id,
351+
err: RpcResponseError,
351352
) {
352353
// check that this request is pending
353354
match self.chains.call_by_id(chain_id, |chain| {
354-
chain.inject_error(network, batch_id, &peer_id, request_id)
355+
chain.inject_error(network, batch_id, &peer_id, request_id, err)
355356
}) {
356357
Ok((removed_chain, sync_type)) => {
357358
if let Some((removed_chain, remove_reason)) = removed_chain {

0 commit comments

Comments
 (0)