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-6112] Fix possible deadlock when recording threads #1011

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Feb 23, 2021

Goal

There was the possibility of a deadlock when recording all threads (for a handled event) due to use of the Objective-C runtime while other threads were suspended.

This issue was manifesting as an intermittent failure of the unit tests to complete within their timeout.

This issue was introduced in release v6.2.3 by #992

Changeset

backtrace_for_callstack() was being called while threads were suspended, and accepted an NSArray resulting in the Objective-C runtime being called for reference counting, reading the array items and their values.

Refactored the methods and functions to ensure the callStackReturnAddresses NSArray is converted to a plain C struct before any mach thread related calls are made.

Testing

Tested by running unit tests locally.

@nickdowell nickdowell changed the title Fix possible deadlock when recording threads [PLAT-6112] Fix possible deadlock when recording threads Feb 23, 2021
@nickdowell nickdowell marked this pull request as ready for review February 23, 2021 15:06
@github-actions
Copy link

Infer: No issues found 🎉

OCLint: No issues found 🎉

Bugsnag.framework binary size decreased by 168 bytes from 1,061,456 to 1,061,288 🎉

Generated by 🚫 Danger

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