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

Version 1.11.2 of KSCrash (pinned with Bugsnag 5.7) causes deadlock while reporting user exceptions while sending reports #143

Closed
anderscarling opened this issue Apr 18, 2017 · 8 comments

Comments

@anderscarling
Copy link

Since KSCrash commit b1d8965 (released in 1.11.0) added a call to kscrs_getCrashReportPath to kscrash_i_onCrash (in KSCrashC.c) is seems KSCrash will deadlock if an exception is recorded while g_mutex (in KSCrashReportStore.c) is held by another thread.

This seems to happen because exception recording suspends all other threads, including the one currently holding the g_mutex. This has a high-ish occurrence rate if you call [Bugsnag notify:] a few times in a row as BugsnagNotifier notify: ends with doing a [self performSelectorInBackground:@selector(sendPendingReports) withObject:nil];.

It seems this is fixed as a side effect of [KSCrash commit 4899c8517 (released in 1.12.0)]((kstenerud/KSCrash@4899c85) as it no longer claims g_mutex to get the path for the crash report.

I'm currently trying to build bugsnag-cocoa with kscrash 1.12.0 to validate that it actually fixes the issue..

@kattrali
Copy link
Contributor

Thanks for the report, @anderscarling. I'm in the process of testing against KSCrash 1.15.8 to fix this and some additional issues. There should be a release shortly.

@anderscarling
Copy link
Author

anderscarling commented Apr 18, 2017

Nice @kattrali! Please let me know if you want me to test it against my project before you push the pod :)

It would be nice if new version of bugsnag-cocoa exposed the new "logAllThreads" parameter of KSCrash-reportUserException:, freezing and dumping threads is definitely overkill in most of our use cases so would be nice to get rid of that overhead.

Anyhow, I can confirm that I'm deadlock free using my 1.12.0 branch of bugsnag-cocoa

@kattrali
Copy link
Contributor

Awesome! Already got a patch in for logAllThreads as well. :)

@kattrali
Copy link
Contributor

kattrali commented Apr 18, 2017

@anderscarling I'll need to hold on this to investigate a regression in how KSCrash handles crashes from malloc corruption. It's present in at least 1.13.2 onwards, but I haven't found the start yet, except to say it isn't present in 1.11.2.

@kattrali kattrali reopened this Apr 18, 2017
@anderscarling
Copy link
Author

@kattrali Any progress? :)

@snmaynard
Copy link
Contributor

5.8 was released earlier that downgrades the version of KSCrash because of the newer versions we were seeing reliability issues with in testing. We are still planning on upgrading KSCrash, but upon seeing the issues with it we rolled back to the last known good version.

@anderscarling
Copy link
Author

ok, thanks!

@fractalwrench
Copy link
Contributor

Closing as we have forked an earlier version of KSCrash which does not cause a deadlock.

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

No branches or pull requests

4 participants