nethermind icon indicating copy to clipboard operation
nethermind copied to clipboard

RPC response abruptly interrupted by timeout json error.

Open smartprogrammer93 opened this issue 1 year ago • 2 comments

Description RPC call being interrupted by timeout.

Steps to Reproduce

  1. call rpc with array of request instead of just one in the same call. It was reported by someone on gnosis node.

Actual behavior returns the following:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "address": "0x0214014f69b11a80462f52a123fcbfa830e3fa11",
            "blockHash": "0x97f81688901dc30f3dd88706b56aeffa1ca599672fc862f9f8dcd0daff00ef56",
            "blockNumber": "0x2051f3c",
            "data": "0x000000000000000000000000f45e6e13ce8eaf623dac30193a28419293e7fabf0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064e318b52b0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e8a898d19847b16bb65c826fa1d9a735be6b70ee00000000000000000000000076e12efa4d44c4f495e82fba0792b0bf1af91f4f00000000000000000000000000000000000000000000000000000000",
            "logIndex": "0x0",
            "removed": false,
            "topics": [
                "0x4c8a9c748e976c17c2eb2c2bc50da76eac9cd90ff529f0fe900e0c10a179f031",
                "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x5e96df6c7831235f39530c213de1ee20b2780f5415b600f0859a813dad1d5d8b"
            ],
            "transactionHash": "0x17a378752998c623aa6ffa0093f0c71b8b090017568ff02039dd20c90dc1b125",
            "transactionIndex": "0x1",
            "transactionLogIndex": "0x0"
        }{
            "jsonrpc": "2.0",
            "error": {
                "code": -32016,
                "message": "Request was canceled due to enabled timeout."
            },
            "id": null
        }

Expected behavior either return the error json part only, or continue producing the proper resoponse.

On latest release 1.26.0

smartprogrammer93 avatar May 23 '24 08:05 smartprogrammer93

This is unfortunately by design. Logs are lazyly streamed through IEnumerable<> and then they can time out after some of them were already returned.

LukaszRozmej avatar May 23 '24 09:05 LukaszRozmej

@LukaszRozmej at least, it should seperate the array objects with a comma and close the array bracket so it is valid json

smartprogrammer93 avatar May 23 '24 09:05 smartprogrammer93

@rjnrohit any update on that?

kamilchodola avatar May 29 '24 12:05 kamilchodola

@kamilchodola I had a discussion with @LukaszRozmej , we have come to conclusion that:

  1. we will follow the reth implementation as we will buffer till the whole log scans completes for a request
  2. And, there would be limit imposed on the number of logs that can be returned while serving a request

So, I'm adding the changes to follow the above agreement.

rjnrohit avatar May 30 '24 09:05 rjnrohit

@rjnrohit Any PR for that?

kamilchodola avatar Jun 03 '24 09:06 kamilchodola

will start working once I'm done with https://github.com/NethermindEth/nethermind/pull/7119

rjnrohit avatar Jun 03 '24 12:06 rjnrohit