nethermind icon indicating copy to clipboard operation
nethermind copied to clipboard

Better timeout indication on streaming json rpc requests

Open LukaszRozmej opened this issue 4 years ago • 5 comments

Some JSON RPC requests are streamed, lazy evaluated (eth_getLogs for example). If the response becomes too large it is send through multiple http responses in chunks. If the timeout occurs it just abruptly stops sending data.

It would be good to handle timeouts better (http codes?) for those scenarios. But I am not sure if its possible.

LukaszRozmej avatar Nov 22 '21 09:11 LukaszRozmej

For reference:

I am querying the CirclesUBI Hub contract on the xDai Mainnet for all "TRUST" events (contract address: 0x29b9a7fBb8995b2423a71cC17cf9810798F6C543), the code is (in Java with web3j):

EthFilter eventFilter = new EthFilter(DefaultBlockParameter.valueOf(index), DefaultBlockParameter.valueOf(currentBlock), hub.getContractAddress());
String encodedEventSignature = EventEncoder.encode(Hub.TRUST_EVENT);

and I am going from the deploy block (about 12000000) to LATEST (currently around 19000000) and expect around 1mio events, so "a lot".

Without high enough Timeout, I get back different indeterministic number of events, but no indicator that events are missing.

ice09 avatar Nov 22 '21 12:11 ice09

@ice09 recommended solution is to split this filter into multiple by using some block numbers ranges.

For example in the merge when consensus client syncs deposit contract it uses block ranges of 1000.

LukaszRozmej avatar Dec 15 '21 10:12 LukaszRozmej

Yes, thanks, that's what I did (for a on-site running node I used 10000) and it works very well. Still the behaviour could be more user/developer-friendly.

ice09 avatar Dec 15 '21 11:12 ice09

we will still look into it

LukaszRozmej avatar Dec 15 '21 18:12 LukaszRozmej

we will buffer eth_getLogs for now

LukaszRozmej avatar Jun 04 '24 14:06 LukaszRozmej

Wasn't that already addressed? I recall we did something in that area.

@LukaszRozmej @rjnrohit

kamilchodola avatar Jan 09 '25 10:01 kamilchodola

Are you referring to this issue: https://github.com/NethermindEth/nethermind/issues/7064 @kamilchodola ?

rjnrohit avatar Jan 09 '25 11:01 rjnrohit

Yeah probably i recall this one @rjnrohit

kamilchodola avatar Jan 09 '25 11:01 kamilchodola