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

RPC method crashed: runtime error: invalid memory address or nil pointer dereference #26830

Closed
jdevcs opened this issue Mar 8, 2023 · 4 comments · Fixed by #26862
Closed
Assignees
Labels

Comments

@jdevcs
Copy link

jdevcs commented Mar 8, 2023

With Geth ( recently published stable on docker ) local POA NW when I use safe or finalized tags, geth crashes.

Sample request

curl --location --request POST 'http://127.0.0.1:8545/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "eth_getBlockTransactionCountByNumber",
    "params": [
        "safe"
    ]
}'

returns:

{
    "jsonrpc": "2.0",
    "id": "1",
    "error": {
        "code": -32603,
        "message": "method handler crashed"
    }
}

with logs


INFO [03-08|13:21:04.536] Commit new sealing work                  number=1 sealhash=229c06..5132e5 uncles=0 txs=0 gas=0 fees=0 elapsed="702.427µs"
ERROR[03-08|13:21:39.404] RPC method eth_getBlockTransactionCountByNumber crashed: runtime error: invalid memory address or nil pointer dereference
goroutine 174 [running]:
github.com/ethereum/go-ethereum/rpc.(*callback).call.func1()
	github.com/ethereum/go-ethereum/rpc/service.go:199 +0x89
panic({0x16ef560, 0x2762690})
	runtime/panic.go:884 +0x213
github.com/ethereum/go-ethereum/eth.(*EthAPIBackend).BlockByNumber(0xc000012318, {0x17c0160?, 0x17c0160?}, 0xc00042b5e0?)
	github.com/ethereum/go-ethereum/eth/api_backend.go:132 +0xa0
github.com/ethereum/go-ethereum/internal/ethapi.(*TransactionAPI).GetBlockTransactionCountByNumber(0x1?, {0x1c94978?, 0xc00042b5e0?}, 0x46da59?)
	github.com/ethereum/go-ethereum/internal/ethapi/api.go:1509 +0x2b
reflect.Value.call({0xc0005c2300?, 0xc000297918?, 0x7fc088d928c8?}, {0x19356b1, 0x4}, {0xc00042b680, 0x3, 0x0?})
	reflect/value.go:586 +0xb07
reflect.Value.Call({0xc0005c2300?, 0xc000297918?, 0x1?}, {0xc00042b680?, 0x1?, 0x16?})
	reflect/value.go:370 +0xbc
github.com/ethereum/go-ethereum/rpc.(*callback).call(0xc0001337a0, {0x1c94978?, 0xc00042b5e0}, {0xc00017f110, 0x24}, {0xc000618ca8, 0x1, 0x4d3297?})
	github.com/ethereum/go-ethereum/rpc/service.go:205 +0x3c5
github.com/ethereum/go-ethereum/rpc.(*handler).runMethod(0xc000404558?, {0x1c94978?, 0xc00042b5e0?}, 0xc000214230, 0x1?, {0xc000618ca8?, 0x417230?, 0x1722400?})
	github.com/ethereum/go-ethereum/rpc/handler.go:513 +0x45
github.com/ethereum/go-ethereum/rpc.(*handler).handleCall(0xc00024e240, 0xc0003fef60, 0xc000214230)
	github.com/ethereum/go-ethereum/rpc/handler.go:459 +0x239
github.com/ethereum/go-ethereum/rpc.(*handler).handleCallMsg(0xc00024e240, 0xc0003feff0?, 0xc000214230)
	github.com/ethereum/go-ethereum/rpc/handler.go:420 +0x237
github.com/ethereum/go-ethereum/rpc.(*handler).handleMsg.func1(0xc0003fef60)
	github.com/ethereum/go-ethereum/rpc/handler.go:256 +0x1a5
github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc.func1()
	github.com/ethereum/go-ethereum/rpc/handler.go:348 +0xc5
created by github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc
	github.com/ethereum/go-ethereum/rpc/handler.go:344 +0x8d

when I use geth docker v1.11.2 I am getting expected results:

{
    "jsonrpc": "2.0",
    "id": "1",
    "result": null
}
@jsvisa
Copy link
Contributor

jsvisa commented Mar 9, 2023

I've tried this RPC on go-ethereum mainnet, and no error occurred. What network are you running?

request

{
    "id": "2",
    "jsonrpc": "2.0",
    "method": "eth_getBlockTransactionCountByNumber",
    "params": [
        "safe"
    ]
}

response

{
    "id": "2",
    "jsonrpc": "2.0",
    "result": "0x6f"
}

@jdevcs
Copy link
Author

jdevcs commented Mar 9, 2023

With Geth ( recently published stable on docker ) local POA NW when I use safe or finalized tags, geth crashes.

@jsvisa

@lightclient
Copy link
Member

safe and finalized tags were designed specifically for accessing post-merge EL data where we have these concepts via the beacon chain. I think the best thing to do is not support these tags on non proof-of-stake networks.

@jdevcs
Copy link
Author

jdevcs commented Mar 13, 2023

I think the best thing to do is not support these tags on non proof-of-stake networks.

@lightclient Thanks. Yes, exactly, and its must not crash with above mentioned geth logs, and should return valid ( null ) result. like:

{
    "jsonrpc": "2.0",
    "result": null
}

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.

4 participants
@jsvisa @lightclient @jdevcs and others