-
Notifications
You must be signed in to change notification settings - Fork 267
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
Properly handle chunked requests on WebsocketServer #1589
Conversation
@fernandorubal can you provide some tests for this one? |
pipeline: run |
A new test was added in Web3WebSocketServerTest.java called smokeTestWithBigJson that uses the same logic that the original smokeTest, but generates a JSON message that exceeds 2048 bytes (OkHttpClient buffer) so it gets sent chunked to the WebSocket Server. |
Hello again, any news? Thanks. |
pipeline: run |
5acbe58
to
db4fa3f
Compare
0e2b942
to
ec32a6a
Compare
pipeline: run |
ec32a6a
to
86c08f2
Compare
Kudos, SonarCloud Quality Gate passed! |
Description
This PR intends to solve a bug when processing incomplete or chunked requests received through the Websocket endpoint.
Motivation and Context
This PR aims to provide a solution to a bug causing chunked requests sent to the Rskj WebSocket Endpoint to be treated as separate requests.
This bug was discovered when using the official Ethereum Go client to send a transaction. The geth client sends data > 1024 bytes in chunks. That caused the Web3WebSocketServer to read every chunk of 1024 bytes as a new request, failing in consequence to process it as a valid json.
Adding the WebsocketFrameAggregator handler to the pipeline provides a way to properly handle those chunked requests.
How Has This Been Tested?
This patch was tested using geth client with successful results
A new test was added in Web3WebSocketServerTest.java called smokeTestWithBigJson that uses the same logic that the original smokeTest, but generates a JSON message that exceeds 2048 bytes (OkHttpClient buffer) so it gets sent chunked to the WebSocket Server.
Types of changes
Checklist:
https://netty.io/4.0/api/io/netty/handler/codec/http/websocketx/WebSocketFrameAggregator.html