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

Log WARN for failed RPC response #8138

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -34,8 +34,11 @@
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JsonRpcObjectExecutor extends AbstractJsonRpcExecutor {
private static final Logger LOG = LoggerFactory.getLogger(AbstractJsonRpcExecutor.class);
private final ObjectWriter jsonObjectWriter = createObjectWriter();

public JsonRpcObjectExecutor(
Expand Down Expand Up @@ -76,7 +79,11 @@ private void handleJsonObjectResponse(
try (final JsonResponseStreamer streamer =
new JsonResponseStreamer(response, ctx.request().remoteAddress())) {
// underlying output stream lifecycle is managed by the json object writer
lazyTraceLogger(() -> getJsonObjectMapper().writeValueAsString(jsonRpcResponse));
if (jsonRpcResponse.getType() != RpcResponseType.ERROR) {
lazyTraceLogger(() -> getJsonObjectMapper().writeValueAsString(jsonRpcResponse));
} else {
LOG.warn("RPC error: {}", getJsonObjectMapper().writeValueAsString(jsonRpcResponse));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be pretty heavy on RPC nodes, I’m thinking of “Block not found” errors for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, this could potentially blow up the logs for a lot of users, even if they are genuine issues.
Maybe we need some sort of log throttling mechanism to go with it?

Would favour the more specific METHOD_NOT_FOUND but unless we also have throttling, I think we'd still need some confidence about the impact of this on a variety of usecases/networks.

jsonObjectWriter.writeValue(streamer, jsonRpcResponse);
}
}
Expand Down
Loading