{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"execution timeout"}}
If you have come across the error above then this FAQ is for you.
The most common methods that return these timeouts are:
- trace_block
- debug_traceBlockByNumber
- debug_traceTransaction
These methods are very resource-intensive, as they require the node to perform a full trace of all the transactions in a block, which can take a considerable amount of time and computational resources. As a result, these methods may sometimes result in an "execution timeout" error.
Solution
Each blockchain client has a default timeout for each method call, it's commonly around 5 seconds. If the call exceeds the timeout value, you'll receive the error. To override this value, you'll need to pass the following parameter
"timeout": "300s"
The JSON payload should become
{ "id": 1, "jsonrpc": "2.0", "method": "debug_traceBlockByNumber", "params": [ "0x3CA8A5F", { "tracer": "callTracer", "timeout": "300s" } ] }
When using an SDK, you'll need to change the timeout value in the configuration of the provider object:
var provider = new Web3HttpProvider('http://localhost:8545',{timeout:300});
from web3 import Web3 w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545", request_kwargs={'timeout': 300}))
If you're still seeing the error even with a huge timeout like 300 seconds, please reach out to the Support Team 🚀
Comments
0 comments
Article is closed for comments.