-
Notifications
You must be signed in to change notification settings - Fork 382
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
Make rpc serialization chunk size configurable #9961
Make rpc serialization chunk size configurable #9961
Conversation
private static final String POSTLUDE = "])"; | ||
private static final String PRELUDE = "].concat(["; | ||
|
||
private final StringBuffer buffer; | ||
private final int maximumArrayLength = Integer.getInteger("gwt.rpc.maxPayloadChunkSize", 1 << 15); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this static? It should only need to be read once (and used consistently afterwards)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes true, that was my initial change but then I looked at the gtw.rpc.version
property which does seem runtime configurable. I can change it back to static if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that makes sense. System.getProperty
is a blocking call on older JVMs, but at least on Java 11 this is replaced by a ConcurrentHashMap.
I suspect the reason that GWT historically looked up the value on each call is to allow the SerializationException
to be thrown when a call was made, rather than when the class was initialized, since the range of accepted values could change release to release.
I think I'm fine leaving this max size as a runtime lookup, as you have it written.
Will leave the PR open a bit longer for any other thoughts on the matter.
Looks like tests weren't run on this PR, or even compiled? I'll submit a followup to correct the compile error... |
@codemasterover9000 PTAL #9963 |
Yeah sorry I assumed that the tests would run automatically after commit. I only tested the compile of the single file from intellij. As I can not get GWT te compile anymore using ant after updating the project. I should have mentioned that though... sorry about that. |
Make the RPC chunk size configurable through a system property
gwt.rpc.maxPayloadChunkSize
. This allows implementors to circumvent the RPC protocol version to fallback to version 7 on large payloads. Which in the current client implementation uses unsafe javascript eval, preventing proper operation on sites with CSP's restrictingunsafe-eval
.Fixes #9578