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

Startup Crash: Only block Init to flush events if the app crashed on the last run #1164

Open
Tracked by #12
bruno-garcia opened this issue Aug 24, 2021 · 1 comment
Labels
Feature New feature or request

Comments

@bruno-garcia
Copy link
Member

bruno-garcia commented Aug 24, 2021

Currently we block Init to flush envelopes if there's anything on disk. Since the introduction of other envelope item types, we could be blocking Init for up to InitCacheFlushTimeout to flush out those items that could anyway be flushed asynchronously.

The goal behind InitCacheFlushTimeout and blocking init was to ensure crashes that happen right after Sentry is initialized and bring down the app are captured. We need to focus on that goal without the side effect of slowing down app starts for other reasons.

Suggested solution: On unhandled errors we write a marker file to disk such as crashed-at with a timestamp in it. This could be done exclusively on the UnhandledException integration and could be written by native integrations such as the iOS SDK for Unity. The SDK will only block to flush if such marker file exists. Additionally we should remove that marker file if we were able to flush the payload successfully before shutting down, which is expected on normal CLR/CoreCLR execution. This is mainly an issue on mobile where the OS often terminates the app if it tries to open a TLS connection (what we noticed during our Android tests on Java and C# unhandled exception handlers).

More context at: getsentry/sentry-unity#286 (comment)

@bruno-garcia bruno-garcia added the Feature New feature or request label Aug 24, 2021
@bruno-garcia bruno-garcia added this to Backlog in Mobile Platform Team Archived via automation Aug 24, 2021
@bruno-garcia bruno-garcia added this to To Do in v3.x Aug 24, 2021
@bruno-garcia bruno-garcia moved this from To Do to In Progress in v3.x Aug 24, 2021
@bruno-garcia bruno-garcia moved this from In Progress to To Do in v3.x Aug 24, 2021
@bruno-garcia bruno-garcia changed the title Only block Init to flush events if the app crashed on the last run Startup Crash: Only block Init to flush events if the app crashed on the last run Apr 27, 2022
@bruno-garcia
Copy link
Member Author

This feature can be added to any SDK that has offline caching. It came up in the iOS SDK: getsentry/sentry-cocoa#316 and possibly others.
Ideally we write a 'spec' that guides the implementation of it once we figure out the best approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
Status: No status
Archived in project
Development

No branches or pull requests

3 participants