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-4707] Record thread information for unhandled JS errors #766

Merged
merged 6 commits into from
Jul 31, 2020

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Jul 29, 2020

Goal

Records thread information for unhandled JS errors. The thread information was not captured for unhandled JS errors when BSGThreadSendPolicyUnhandledOnly was set because the native layer used the presence of BSG_KSCrashTypeUserReported as the crashType to determine whether an error was unhandled instead.

This change alters the captureThreadTrace method to calculate whether threads should be captured or not, and sets threadTracingEnabled appropriately. By default this value is set when installing KSCrash - for handled errors this value is overwritten.

Additionally the crash context has been set to a local struct, which avoids the scenario where multiple notify calls overwrite a global struct.

Note: sending a handled error will overwrite the crash context currently which means the thread send behaviour is incorrect for unhandled errors sent after handled errors. This will be addressed in a separate PR which avoids reusing the crash context.

Tests

Covered by existing E2E test coverage, additionally verified in an Objective C example app against handled + unhandled errors.

References

@fractalwrench
Copy link
Contributor Author

Addressed review feedback

Copy link
Contributor

@tomlongridge tomlongridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 minor points, but otherwise LGTM

@fractalwrench fractalwrench marked this pull request as ready for review July 30, 2020 15:10
@tomlongridge tomlongridge changed the title Record thread information for unhandled JS errors [PLAT-4707] Record thread information for unhandled JS errors Jul 31, 2020
@tomlongridge tomlongridge merged commit 20d33f8 into react-native-plugin Jul 31, 2020
@tomlongridge tomlongridge deleted the rn-thread-unhandled branch July 31, 2020 14:30
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