Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more backwards sync logging to debug nimbus issue #5470

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public String getName() {
@Override
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final FilterParameter filter = requestContext.getRequiredParameter(0, FilterParameter.class);
LOG.atTrace().setMessage("eth_getLogs FilterParameter: {}").addArgument(filter).log();

if (!filter.isValid()) {
return new JsonRpcErrorResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public static GetBodiesFromPeerTask forHeaders(
protected PendingPeerRequest sendRequest() {
final List<Hash> blockHashes =
headers.stream().map(BlockHeader::getHash).collect(Collectors.toList());
LOG.atTrace()
.setMessage("Requesting {} bodies with hashes {}.")
.addArgument(blockHashes.size())
.addArgument(blockHashes)
.log();
final long minimumRequiredBlockNumber = headers.get(headers.size() - 1).getNumber();

return sendRequestToPeer(
Expand All @@ -106,6 +111,11 @@ protected Optional<List<Block>> processResponse(

final BlockBodiesMessage bodiesMessage = BlockBodiesMessage.readFrom(message);
final List<BlockBody> bodies = bodiesMessage.bodies(protocolSchedule);
LOG.atTrace()
.setMessage("Received {} bodies: {}")
.addArgument(bodies.size())
.addArgument(bodies)
.log();
if (bodies.size() == 0) {
// Message contains no data - nothing to do
LOG.debug("Message contains no data. Peer: {}", peer);
Expand All @@ -128,6 +138,13 @@ protected Optional<List<Block>> processResponse(
// Clear processed headers
headers.clear();
}
LOG.atDebug()
.setMessage("Associated {} bodies with {} headers to get {} blocks with these hashes: {}")
.addArgument(bodies.size())
.addArgument(headers.size())
.addArgument(blocks.size())
.addArgument(blocks.stream().map(Block::getHash).collect(Collectors.toList()))
.log();
return Optional.of(blocks);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ protected CompletableFuture<List<BlockHeader>> executeTaskOnCurrentPeer(
return executeSubTask(task::run)
.thenApply(
peerResult -> {
LOG.debug(
"Get {} block headers by hash {} from peer {} has result {}",
LOG.trace(
"Got {} block headers by hash {} from peer {} has result {}",
count,
referenceHash,
currentPeer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public synchronized boolean isSyncing() {
}

public synchronized void updateHead(final Hash headHash) {
LOG.atTrace().setMessage("Maybe update maybeHead to {}").addArgument(headHash).log();
if (Hash.ZERO.equals(headHash)) {
maybeHead = Optional.empty();
} else {
Expand Down Expand Up @@ -331,6 +332,11 @@ protected Void saveBlock(final Block block) {
@VisibleForTesting
protected void possiblyMoveHead(final Block lastSavedBlock) {
final MutableBlockchain blockchain = getProtocolContext().getBlockchain();
LOG.atTrace()
.setMessage("possibleMoveHead(lastSavedBlock={}); maybeHead={}")
.addArgument(Optional.ofNullable(lastSavedBlock).map(Block::toLogString).orElse("null"))
.addArgument(maybeHead)
.log();
if (maybeHead.isEmpty()) {
LOG.debug("Nothing to do with the head");
return;
Expand Down