fix(jsonrpc): don't print stacktrace in jsonrpc when request overload#6867
Merged
kuny0707 merged 2 commits intoJul 8, 2026
Merged
Conversation
bladehan1
approved these changes
Jul 7, 2026
…equestErrorHandler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Let Jetty
BadMessageExceptionwith statusHttpStatus.PAYLOAD_TOO_LARGE_413propagate back to the existing unifiedOversizedRequestErrorHandlerinstead of being absorbed inside the servlet/filter chain.The change has two parts:
RateLimiterServletno longer handles oversized-requestBadMessageExceptionlocally; it rethrows it.HttpInterceptorstill records failure metrics, but now rethrows onlyBadMessageException(413)so that oversized chunked requests can reach Jetty's existing unified error path. Other exceptions keep the previous swallow-and-meter behavior.This keeps chunked JSON-RPC oversized requests aligned with the pre-existing unified oversized-request handling path in
HttpService, instead of introducing a servlet-specific 413 implementation.Why are these changes required?
For
Transfer-Encoding: chunked, Jetty only discovers an oversized request while the servlet is reading the request body. In the JSON-RPC path, that expected 413 exception used to be swallowed inside the servlet/filter chain before it could reach Jetty's unified oversized-request error handler, which led to noisy ERROR stack traces and inconsistent handling.Other HTTP endpoints can hit the same Jetty streaming exception timing. Many HTTP servlets already catch and convert errors locally, but for paths where a 413 does bubble up, this change makes them reuse the same top-level oversized-request handler instead of splitting behavior between ad hoc local handling and Jetty error handling.
This PR has been tested by:
./gradlew :framework:test --tests "org.tron.core.services.http.RateLimiterServletTest" --tests "org.tron.core.services.filter.HttpInterceptorTest" --tests "org.tron.core.jsonrpc.JsonrpcServiceTest.testJsonRpcSizeLimitIntegration"./gradlew checkstyleMain checkstyleTestgit diff --checkFollow up
None.
Extra details
RateLimiterServletTestnow verifies that oversized-requestBadMessageExceptionis propagated rather than handled in-place.HttpInterceptorTestlocks down the narrower behavior change: rethrowBadMessageException(413), keep swallowing non-413 exceptions.JsonrpcServiceTeststill verifies that oversized chunked JSON-RPC requests return 413 end-to-end.