Skip to content

Recover from panics in the datasource discovery hook#320

Open
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/proxy-discovery-panic-recovery
Open

Recover from panics in the datasource discovery hook#320
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/proxy-discovery-panic-recovery

Conversation

@damilolaedwards

Copy link
Copy Markdown

Summary

OnDiscover runs on the background discovery goroutine with nothing above it
to catch a panic. A bug in module activation or resource registration
triggered by a newly discovered datasource would escape unrecovered and
crash the whole server, taking every in-flight request down with it.

Wraps the hook invocation so a panic is caught and logged instead of
killing the process, and the discovery loop keeps running on the next tick.

Test plan

  • go test -race ./pkg/proxy/...
  • New test drives a panicking OnDiscover hook through Discover and
    confirms the client survives and stays usable for a subsequent call
  • go build ./..., go vet ./...

OnDiscover runs on the background discovery goroutine with no
supervisor above it. A panic anywhere in module activation or resource
registration triggered by a newly discovered datasource would escape
unrecovered and crash the whole server, taking down every in-flight
request along with it.

Wrap the hook call so a panic is caught, logged, and the discovery
loop keeps running instead of taking the process down with it.
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.

1 participant