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

core: prevent block level tracers from crashing the node #30831

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Nov 28, 2024

This PR is a work in progress to add some protection around calling the tracers.

Example of running this with the included panic:y tracer

$ go run ./cmd/geth --dev --vmtrace crash  console
...
> eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[0], value:1})
INFO [11-28|15:29:54.151] Setting new local account                address=0x23dbe6cB33eFc438a329A82332f4D534d05Ccc1e
INFO [11-28|15:29:54.151] Submitted transaction                    hash=0x7873a51aad23813f54f1d1a13bdaf488261730da8f7f0d375e9da44e2e01ac10 from=0x23dbe6cB33eFc438a329A82332f4D534d05Ccc1e nonce=0 recipient=0x23dbe6cB33eFc438a329A82332f4D534d05Ccc1e value=1
"0x7873a51aad23813f54f1d1a13bdaf488261730da8f7f0d375e9da44e2e01ac10"
> INFO [11-28|15:29:54.152] Starting work on payload                 id=0x03ae2b05cba5436c
INFO [11-28|15:29:54.153] Updated payload                          id=0x03ae2b05cba5436c number=1 hash=936f7f..7d2bd9 txs=1 withdrawals=0 gas=21000 fees=2.1e-14 root=981368..692038 elapsed="826.575µs"
WARN [11-28|15:29:54.154] Tracer OnBlockStart exited with panic, disabling tracer err=OnBlockStart
WARN [11-28|15:29:54.154] Tracer OnBlockEnd exited with panic, disabling tracer err=OnBlockEnd
INFO [11-28|15:29:54.154] Stopping work on payload                 id=0x03ae2b05cba5436c reason=delivery
panic: OnEnter

goroutine 47 [running]:
github.com/ethereum/go-ethereum/eth/tracers/live.(*crash).OnEnter(...)
        /home/user/go/src/github.com/ethereum/go-ethereum/eth/tracers/live/crash.go:72

Ideally perhaps we should not just disable the hook, but actually stop chain processing. That is a bit more tricky, though. Opening for discussion,

@s1na
Copy link
Contributor

s1na commented Nov 29, 2024

Ideally perhaps we should not just disable the hook, but actually stop chain processing

Maybe that's what you meant but what about gracefully shutting down? I feel like if someone is running a live tracer, that is the purpose of running the node. So the node might as well stop to indicate there is an issue.

@namiloh
Copy link

namiloh commented Nov 29, 2024

Yes, that is what I meant

@maoueh
Copy link
Contributor

maoueh commented Dec 2, 2024

I second for graceful shutdown, in production I want a hard-break on tracing if something like this happen.

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

Successfully merging this pull request may close these issues.

4 participants