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

Some callbacks do not have their Exceptions caught yet #2123

Closed
Tracked by #21
adinauer opened this issue Jun 22, 2022 · 3 comments · Fixed by #2291
Closed
Tracked by #21

Some callbacks do not have their Exceptions caught yet #2123

adinauer opened this issue Jun 22, 2022 · 3 comments · Fixed by #2291

Comments

@adinauer
Copy link
Member

Integration

sentry

Java Version

any

Version

6.1.2

Steps to Reproduce

There are multiple places where an Exception thrown by a callback is not caught.

  • SentryAndroid.init param Sentry.OptionsConfiguration<SentryAndroidOptions> configuration
  • Local scope callback for captureX methods with param ScopeCallback callback
  • ... there's probably more

Expected Result

Exceptions should be caught and we should downgrade gracefully (throw away an event, don't enable the SDK, ...).

Actual Result

Exceptions are not caught

@philipphofmann
Copy link
Member

If we decide to throw away the event, we should ensure this information ends up in client reports.

@marandaneto
Copy link
Contributor

If we decide to throw away the event, we should ensure this information ends up in client reports.

Actually, it's the opposite, by swallowing the exception during eg beforeSend, we make sure that events get sent.

@markushi
Copy link
Member

markushi commented Oct 11, 2022

Potential callbacks which should not crash:
via Sentry

item has try/catch has logging note
init / OptionsConfiguration<T>.configure x x

via Hub

item has try/catch has logging note
withScope(..., ScopeCallback) x x
configureScope(..., ScopeCallback) x x
captureEvent(..., ScopeCallback) x x
captureMesssage(..., ScopeCallback) x x
captureException(..., ScopeCallback) x x

via SentryOptions

item has try/catch has logging note
BeforeSendCallback x x called by SentryClient.captureEvent
BeforeBreadcrumbCallback x x called by Scope.addBreadcrumb
TracesSamplerCallback x x called by TracesSampler.sample
ProfilesSamplerCallback x x called by TracesSampler.sample

Ignored for custom implementations of

  • Integration
  • ISentryClient
  • ILogger
  • IEnvelopeReader.read
  • IDebugImagesLoader
  • IEnvelopeCache
  • IEnvelopeReader
  • HostnameVerifier
  • SSLSocketFactory
  • ISerializer
  • ITransactionProfiler
  • ITransportFactory
  • ITransportGate
  • ISentryExecutorService
  • IScopeObserver
  • IClientReportRecorder

markushi added a commit that referenced this issue Oct 14, 2022
* fix(java): Ensure potential callback exceptions are caught

* Add Changelog for callback exceptions

* Cleanup mock logger setup for HubTest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants