rpc: increase max request content length#22012
rpc: increase max request content length#22012martinboehm wants to merge 1 commit intoethereum:masterfrom
Conversation
In the ropsten network, there are multiple blocks with size over 3MB (height 599275 - 3.35MB, 599281 - 6.52MB). The current limit of 5MB does not allow to fetch these blocks using the eth_getBlock API call. With the overhead of the hex encoding in the rpc protocol, the maximum block size possible to be fetched is about 2.5MB.
|
|
||
| const ( | ||
| maxRequestContentLength = 1024 * 1024 * 5 | ||
| maxRequestContentLength = 1024 * 1024 * 20 |
There was a problem hiding this comment.
Perhaps maxRequestContentLength size should not only be increased, but also be made to be configurable like parity-ethereum. As to what concrete value should it increase to, maybe DDOS attack also needs to be considered.
|
I don't understand why we need to increase the maximum request length to allow for very large responses. I just tested this with the client available in package rpc and it seems to have no problem dealing with large responses sent by the server: |
|
@martinboehm can you provide more information about your issue? It would be nice to know under which circumstances you are hitting this limit. Which client library are you using to access ropsten blocks? |
|
@fjl Hi, we are using websocket connection, not HTTP. The issue is happening in the blockchain indexer and simple explorer https://github.com/trezor/blockbook on initial indexing of the blockchain. |
|
Thanks! So it looks like the issue is with this line: https://github.com/ethereum/go-ethereum/blob/master/rpc/websocket.go#L242. I'm OK with increasing this limit independently of the HTTP request body limit, will look into it. |
|
Replaced by #22385 |
In the ropsten network, there are multiple blocks with the size over 3MB (height 599275 - 3.35MB, 599281 - 6.52MB). The current max request content length limit of 5MB does not allow to fetch these blocks using the
eth_getBlockAPI call. With the overhead of the hex encoding in the rpc protocol, the maximum block size possible to be fetched is only about 2.5MB.Fixed by extending the max request content length size to 20MB - with some buffer room, as the working limit would be about 14-15MB.