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

eth_getLogs request returns an error failed to get logs for block. #23875

Closed
brg8 opened this issue Nov 9, 2021 · 15 comments · Fixed by #23879
Closed

eth_getLogs request returns an error failed to get logs for block. #23875

brg8 opened this issue Nov 9, 2021 · 15 comments · Fixed by #23879
Assignees
Labels

Comments

@brg8
Copy link

brg8 commented Nov 9, 2021

System information

Geth version: v1.10.11
OS & Version: Linux
Commit hash : N/A

Expected behaviour

I expect the following request to return a non-error result.

curl localhost:8545 -X POST -H "Content-Type: application/json" -d '{"id": "someid","method": "eth_getLogs","jsonrpc": "2.0","params": [ { "fromBlock": "0xb45a", "toBlock": "0xb45a" } ]}'

Actual behaviour

It returns an error.

{"jsonrpc":"2.0","id":"someid","error":{"code":-32000,"message":"failed to get logs for block"}}

Steps to reproduce the behaviour

Run the provided curl against a geth node. Some bullets that might help:

  • I have reproduced this on 10 separate archive nodes.
  • Full nodes are hit or miss, some of them respond correctly.
  • Parity/OE and Erigon nodes respond correctly.
  • When I get the error, this appears in the geth logs:
ERROR[11-08|20:15:32.914] Invalid receipt array RLP                hash=4e3a37..5a1bdd err="rlp: expected input list for []*types.LogForStorage, decoding into ([]*rawdb.receiptLogs)[0](rawdb.storedReceiptRLP).Logs"
  • If I add an address to the filters then I get a valid response:
curl localhost:8545 -X POST -H "Content-Type: application/json" -d '{"id": "someid","method": "eth_getLogs","jsonrpc": "2.0","params": [ { "fromBlock": "0xb45a", "toBlock": "0xb45a", "address": "0x1ad1C9CE861a072f843Eab9c070A52e295ad94B5" } ]}'
{"jsonrpc":"2.0","id":"someid","result":[]}

Thank you in advance for your help!

@brg8 brg8 added the type:bug label Nov 9, 2021
@noam-alchemy
Copy link
Contributor

just tested on 1.10.12 as well and the issue is reproducible there as well.

@s1na
Copy link
Contributor

s1na commented Nov 9, 2021

Thanks for reporting the issue and the details. If I'm not mistaken this is caused by #23147 and affects really long-running nodes (2-3 years with no db reset) and specifically when querying logs of older blocks. The cause is that when implementing the optimization in #23147 I hadn't considered nodes that might have a legacy format for receipts in their freezer database. I'm working on a fix now.

@s1na
Copy link
Contributor

s1na commented Nov 9, 2021

Can you please try this branch and see if that solve the issue? https://github.com/s1na/go-ethereum/tree/fix/getlogs-legacy

@brg8
Copy link
Author

brg8 commented Nov 9, 2021

@s1na Yes! That fixes it :)

@miohtama
Copy link

miohtama commented Aug 3, 2022

I just encountered this issue with ethereum/client-go:v1.10.19.

I received one of the:

{'code': -32000, 'message': 'failed to get logs for block #14682553 (0x6d0a1e..590911)

The geth log entry is the same message without further context:

ethereum     | WARN [08-03|18:50:13.633] Served eth_getLogs                       conn=127.0.0.1:56250 reqid=19  duration=595.788162ms err="failed to get logs for block #11802450 (0x638c92..2bad0b)"

I manage to repeat this at least two different blocks on my database.

Though could not repeat this yet. I wonder if there are other reasons why this get logs could fail.

@miohtama
Copy link

miohtama commented Aug 3, 2022

Upgraded to ethereum/client-go:v1.10.21, still getting the same error.

@symbolpunk
Copy link
Contributor

A Prysm user is encountering this error here: https://discord.com/channels/476244492043812875/667761857209040916/1019616603542921236

Will update this with Geth version if/when provided.

@shibug
Copy link

shibug commented Sep 14, 2022

A Prysm user is encountering this error here: https://discord.com/channels/476244492043812875/667761857209040916/1019616603542921236

Will update this with Geth version if/when provided.

I am the one who is facing this issue. My database was fast synced in the past 2 weeks using Geth 1.10.23. So, no old parts here

@shibug
Copy link

shibug commented Sep 14, 2022

I went through the prysm checklist only step #9 fails. Here is the output:
curl http://localhost:3500/eth/v1alpha1/node/eth1/connections {"currentAddress":"http://localhost:8551","currentConnectionError":"failed to get logs for block #15510142 (0x367e14..8e5b43)","addresses":["http://localhost:8551"],"connectionErrors":[]}%

@TheCookieLab
Copy link

I'm another Prysm user seeing this error message on repeat:

Failed to get Logs

Geth (1.10.25+build28116+focal) is fully synced / not optimistic.

@shibug
Copy link

shibug commented Sep 16, 2022

I'm another Prysm user seeing this error message on repeat:

Failed to get Logs

Geth (1.10.25+build28116+focal) is fully synced / not optimistic.

Yep, just like mine but on a different block

@shibug
Copy link

shibug commented Sep 16, 2022

Someone should open this issue

@TheCookieLab
Copy link

This kept causing my Geth to eventually unsync. I deleted my chaindata and synced from scratch which resolved things permanently. If you are still experiencing this I would suggest you do the same.

@lymweb
Copy link

lymweb commented Sep 20, 2022

Yep, just like mine but on a different block

@holiman
Copy link
Contributor

holiman commented Sep 22, 2022

If this issue persists, please open a new ticket, and provide logs from your systems + version information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants