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

[PLAT-5252] Prevent onCrashHandler being called for OOMs #874

Merged
merged 3 commits into from
Oct 30, 2020

Conversation

nickdowell
Copy link
Contributor

Goal

The onCrashHandler is not supposed to be called for OOMs - it's intended to be called when a crash occurs and not in the following launch of the app.

Design

Temporarily setting bsg_g_bugsnag_data.onCrash to NULL was the simplest and least intrusive solution.

The alternative would entail deeper changes in KSCrash to allow BSSerializeDataCrashHandler to detect whether the crash is an OOM.

Changeset

Updated computeDidCrashLastLaunch to prevent onCrashHandler being invoked.

#if BSG_PLATFORM_TVOS || BSG_PLATFORM_IOS was removed to allow the unit test to work on macOS.

Testing

A unit test case (which reports a failure without the changes to BugsnagClient) has been added to verify this behaviour. It works by replacing the shouldReportOOM implementation to trigger an OOM to be sent - we may want to consider the use of a mocking framework such as OCMock if we need more of these kinds of tests.

@nickdowell nickdowell merged commit ccd78b4 into next Oct 30, 2020
@nickdowell nickdowell deleted the feature/skip-user-oncrash-handler-for-ooms branch October 30, 2020 15:44
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.

2 participants