Make tunnel-client max HTTP content length configurable (#3034)#3183
Open
daguimu wants to merge 1 commit into
Open
Make tunnel-client max HTTP content length configurable (#3034)#3183daguimu wants to merge 1 commit into
daguimu wants to merge 1 commit into
Conversation
The tunnel-client `ProxyClient` aggregates HTTP responses with a fixed 10 MB cap (`ArthasConstants.MAX_HTTP_CONTENT_LENGTH`). When a user downloads a JFR recording larger than 10 MB through the tunnel-server, Netty's `HttpObjectAggregator` aborts with `TooLongHttpContentException` and the browser receives only the literal text "error". Introduce a system property `arthas.tunnel.client.max-http-content-length` that overrides the limit for the tunnel-client HTTP aggregator only. Default behavior (10 MB) is unchanged; operators can raise the cap when streaming large recordings without affecting the WebSocket frame or object-view size limits that share the legacy constant. Closes alibaba#3034
hengyunabc
added a commit
that referenced
this pull request
Apr 29, 2026
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.
Problem
When the Arthas Web Console is connected through a tunnel-server and a user clicks Download on a JFR recording larger than 10 MB, the download silently fails and the browser receives a body containing the literal text
error. The tunnel-server logs:Recordings up to 10 MB download fine; anything larger is truncated to the error string.
Root Cause
tunnel-client/ProxyClientconfigures Netty'sHttpObjectAggregatorwith the sharedArthasConstants.MAX_HTTP_CONTENT_LENGTH = 10 MBconstant. When the agent's local Arthas HTTP server emits a response exceeding 10 MB (such as a JFR file), the aggregator rejects it before the bytes can reach the tunnel-server, and the proxy falls back to itserrorpayload.Fix
Introduce a JVM system property
arthas.tunnel.client.max-http-content-length(in bytes) that overrides the cap used byProxyClientonly. The sharedMAX_HTTP_CONTENT_LENGTHconstant is left untouched, so unrelated consumers (WebSocket frame limit,ObjectViewsize limit, etc.) keep their existing semantics.-Darthas.tunnel.client.max-http-content-length=104857600(100 MB) lets users download larger JFR recordings.Files touched:
common/src/main/java/com/taobao/arthas/common/ArthasConstants.java- add property name +getTunnelClientMaxHttpContentLength()helper.tunnel-client/src/main/java/com/alibaba/arthas/tunnel/client/ProxyClient.java- call the helper instead of the hard-coded constant.tunnel-client/pom.xml- add JUnit test scope (matchestunnel-common).Tests Added
tunnel-client/src/test/java/com/taobao/arthas/common/ArthasConstantsTest.javacovers:MAX_HTTP_CONTENT_LENGTHwhen the property is unset.mvn -pl common,tunnel-client -am clean testpasses locally (4 new tests, 0 failures).Impact
MAX_HTTP_CONTENT_LENGTHconstant or the many other call sites that depend on its current value.Closes #3034