Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

5MB limit for RPC requests #8961

Closed
littleskunk opened this issue Jun 23, 2018 · 1 comment
Closed

5MB limit for RPC requests #8961

littleskunk opened this issue Jun 23, 2018 · 1 comment
Labels
F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually.
Milestone

Comments

@littleskunk
Copy link

Before filing a new issue, please provide the following information.

I'm running:

  • Which Parity version?: 1.11.4 (issue first seen 1.9.5, working fine in 1.9.3)
  • Which operating system?: Windows
  • How installed?: via installer
  • Are you fully synchronized?: yes
  • Which network are you connected to?: ethereum
  • Did you try to restart the node?: yes

Your issue description goes here below. Try to include actual vs. expected behavior and steps to reproduce the issue.

expected behavior

I am running a script. I use web3 batch to send one single rpc request containing a few thousend balanceOf requests. In parity 1.9.3 it was working fine.

actual

In parity 1.9.5 a hard 5MB limit was implemented with this commit: paritytech/jsonrpc@06bec6a

1.) Please add an option. I would like to increase that limit.
2.) For some reasons I did not receive the error message PayloadTooLarge. The error message gets lost somewhere. Please return the error message.

steps to reproduce

parity config logging = "rpc=trace"

Run this script:

'use strict';

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545', 0));
const batch = new web3.BatchRequest();

const erc20ABI = [
	{"constant":true,
		"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf",
		"outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},
	{"constant":false,
		"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer",
		"outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"}];

const Contract = '0xb64ef51c888972c908cfacf59b47c1afbc0ab8ac';
const ERC20 = new web3.eth.Contract(erc20ABI, Contract);

var count = 0;

function handleResult(error, ETHBalance) {
	if (error) {
		console.log('Error:', error.message);
		process.exit();
	}
	if (!ETHBalance) {
		console.log('Result:', ETHBalance);
		process.exit();
	}
	console.log(count++);
}

for(var i=0; i<25630; i++) {
	batch.add(ERC20.methods.balanceOf('0x0000000000000000000000000000000000000000').call.request(handleResult));
}
batch.execute();

25629 (-1 for the loop condition) will be loged as one single request with 5242840 bytes. 25630 is too large. No response and nothing on the logfile.

@5chdn 5chdn added this to the 1.12 milestone Jun 28, 2018
@5chdn 5chdn added P7-nicetohave 🐕 Issue is worth doing eventually. F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M6-rpcapi 📣 RPC API. labels Jun 28, 2018
@5chdn 5chdn modified the milestones: 1.12, 1.13 Jun 28, 2018
tomusdrw pushed a commit that referenced this issue Jul 2, 2018
* Add option for user to set max size limit for RPC requests as requested in #8961.

* Add max_payload to tests.

* Change name for max payload option and change value from NUM to MB.

* Fix broken test.

* Fix incorrect indentation.
@5chdn 5chdn modified the milestones: 2.1, 2.2 Jul 17, 2018
@andresilva
Copy link
Contributor

andresilva commented Jul 27, 2018

There's already an option for this --jsonrpc-max-payload (added in #9010). The server is returning a 413 (Payload Too Large) HTTP status code but web3 is not handling this correctly (it just exposes an empty error). You can test this by making the batch request with curl and checking the returned status code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually.
Projects
None yet
Development

No branches or pull requests

3 participants