Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Failed to get logs for block" on eth_getCalls #24606

Closed
zimbabao opened this issue Mar 30, 2022 · 9 comments
Closed

Error "Failed to get logs for block" on eth_getCalls #24606

zimbabao opened this issue Mar 30, 2022 · 9 comments

Comments

@zimbabao
Copy link
Contributor

System information

Geth version: 1.10.13-stable
OS & Version: linux

curl http://localhost:8545 --data '{"jsonrpc":"2.0","id":0,"method":"eth_getLogs","params":[{"fromBlock":"0xbf2084","address":"0xC12BA48c781F6e392B49Db2E25Cd0c28cD77531A","topics":["0x4ac0014773275a3dfb58c58539631006301de41998cce7c4f8698d297c88bb2d"]}]}' -H 'content-type:application/json'

Expected behaviour

curl HTTP://localhost:8545 --data '{"jsonrpc":"2.0","id":0,"method":"eth_getLogs","params":[{"fromBlock":"0xbf2084","address":"0xC12BA48c781F6e392B49Db2E25Cd0c28cD77531A","topics":["0x4ac0014773275a3dfb58c58539631006301de41998cce7c4f8698d297c88bb2d"]}]}' -H 'content-type:application/json'

{"jsonrpc":"2.0","id":0,"result":[{"address":"0xc12ba48c781f6e392b49db2e25cd0c28cd77531a","blockHash":"0x4519d55cb703ff0e8606625d476a25ab382dd7fabb0e01c1a314c3fcd635c8ac","blockNumber":"0xbf2084","data":"0x541ad634cce9293e20f16e25e00ae7e4d003bfae2a9e4d24bc1c1d2db448dce6","logIndex":"0x4e","removed":false,"topics":["0x4ac0014773275a3dfb58c58539631006301de41998cce7c4f8698d297c88bb2d"],"transactionHash":"0xd71d3c90adcce0fabc903fceed668561c92f5be5d8837295f9e46e2f6d99894e","transactionIndex":"0x1a"}]}rajaram@:/Users/rajaram$

Actual behaviour

time curl http://localhost:8545 --data '{"jsonrpc":"2.0","id":0,"method":"eth_getLogs","params":[{"fromBlock":"0xbf2084","address":"0xC12BA48c781F6e392B49Db2E25Cd0c28cD77531A","topics":["0x4ac0014773275a3dfb58c58539631006301de41998cce7c4f8698d297c88bb2d"]}]}' -H 'content-type:application/json'
curl: (52) Empty reply from server

real	6m21.627s
user	0m0.011s
sys	0m0.025s

and logs shows
WARN [03-30|00:03:29.945] Served eth_getLogs                       conn=127.0.0.1:54702 reqid=0      t=6m20.87751607s err="failed to get logs for block"

Steps to reproduce the behaviour

  1. Make request for logs
curl HTTP://localhost:8545 --data '{"jsonrpc":"2.0","id":0,"method":"eth_getLogs","params":[{"fromBlock":"0xbf2084","address":"0xC12BA48c781F6e392B49Db2E25Cd0c28cD77531A","topics":["0x4ac0014773275a3dfb58c58539631006301de41998cce7c4f8698d297c88bb2d"]}]}' -H 'content-type:application/json'
  1. Check logs

Backtrace

[backtrace]

This issue is similar to #23875
When submitting logs: please submit them as text and not screenshots.

@s1na
Copy link
Contributor

s1na commented Mar 30, 2022

Did you notice any other warnings or errors around the log line (WARN [03-30|00:03:29.945] Served eth_getLogs) that you posted?

@holiman
Copy link
Contributor

holiman commented Mar 31, 2022

Related to the empty response: golang/go#47229

When we hit a timeout, the response becomes empty.

@holiman
Copy link
Contributor

holiman commented Mar 31, 2022

The request is to gather all logs from block 12525700 and onwards, which is going to take a while ....

@holiman
Copy link
Contributor

holiman commented Mar 31, 2022

Please try the latest release, and also provide some logs from the geth startup sequence

@arthur-lbchn
Copy link

@holiman Hello, we have the same issue by using web3.js

Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (/worker/node_modules/web3-core-helpers/lib/errors.js:43:16)
    at XMLHttpRequest.request.onreadystatechange (/worker/node_modules/web3-providers-http/lib/index.js:95:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/worker/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/worker/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpRequestError (/worker/node_modules/xhr2-cookies/dist/xml-http-request.js:349:14)
    at ClientRequest.<anonymous> (/worker/node_modules/xhr2-cookies/dist/xml-http-request.js:252:61)
    at ClientRequest.emit (node:events:527:28)
    at Socket.socketOnEnd (node:_http_client:478:9)
    at Socket.emit (node:events:539:35)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

From our internal tests, every eth_getLogs request longer 30 seconds will return an empty response. Do you maybe have an idea where this timeout limit can be managed?

Thanks in advance.

@ibadullaev-inc4
Copy link

same questions

[nariman@notebook chainscale]$ curl --data '{"jsonrpc": "2.0", "id": 1, "method":"eth_getLogs", "params": [{"address":["0x0de2669e8a7a6f6cc0cbd3cf2d1eead89e243208"],"fromBlock":"0x0","toBlock":"latest","topics":[["0xe15729a2f427aa4572dab35eb692c902fcbce57d41642013259c741380809ae2"],["0x0000000000000000000000000000000000000000000000000000000000000001"]]}]}' -H "Content-Type: application/json" -X POST http://127.0.0.1:8545
curl: (52) Empty reply from server

@dvbfcm850
Copy link

same questions

@s1na
Copy link
Contributor

s1na commented Nov 17, 2022

"fromBlock":"0x0","toBlock":"latest"

I bet this request is taking longer than 30s and is timing out. I'm working on returning an error in case of timeout so it's less confusing: #25457

@s1na
Copy link
Contributor

s1na commented Dec 7, 2022

Fixed via #25457

@s1na s1na closed this as completed Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants
@holiman @zimbabao @s1na @arthur-lbchn @ibadullaev-inc4 @dvbfcm850 and others