-
Notifications
You must be signed in to change notification settings - Fork 13
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
Handle more panics #3577
Handle more panics #3577
Conversation
MDrakos
commented
Nov 1, 2024
•
edited by github-actions
bot
Loading
edited by github-actions
bot
DX-3136 Rollbar: Could not report messages as CheckMessages return an error: Error sending messages request: |
internal/poller/poller.go
Outdated
wrappedFn := func() (interface{}, error) { | ||
defer func() { | ||
panics.LogAndPanic(recover(), debug.Stack()) | ||
}() | ||
return pollFunc() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Panics can occur in the goroutine where the poll func is started. If we don't want this automatic wrapping we can update each caller of this library to manually inject it into their pollfunc.
internal/poller/poller.go
Outdated
wrappedFn := func() (interface{}, error) { | ||
defer func() { | ||
panics.LogAndPanic(recover(), debug.Stack()) | ||
}() | ||
return pollFunc() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to implement this as part of the pollFunc that we pass. Reason being that if we catch it here the stacktrace won't point to what caused the panic.
Co-authored-by: Nathan Rijksen <[email protected]>