-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Calling DDLogError on background thread causes EXC_BAD_INSTRUCTION #108
Comments
Found a workaround by turning on exception break point. Was throwing error in DDLog.m:
Changed to:
And no longer crashes... |
I'm getting this error as well, and my workaround was the same. I just tested this: dispatch_queue_t backgroundQueue = dispatch_queue_create("Background Queue", DISPATCH_QUEUE_SERIAL);
dispatch_async(backgroundQueue, ^{
dispatch_get_current_queue();
}); It crashes on the call to dispatch_get_current_queue(). So I don't think that the error is in CocoaLumberjack, but rather in GCD itself. |
A followup: if I get a queue using dispatch_get_global_queue, rather than creating a new one, the crash doesn't occur. |
I too have this problem. Is commenting out the queueLabel line the preferred solution? What's the effect of doing this? |
Fix dispatch_get_current_queue crash (Issue #108)
#121 should fix this |
…UEUE_LABEL I encountered a crash when `RCTCurrentThreadName` called `dispatch_get_current_queue`. There are reports of it crashing e.g. CocoaLumberjack/CocoaLumberjack#108 so better not to call it at all, plus it is deprecated. Since we still want helpful debugging information, use `DISPATCH_CURRENT_QUEUE_LABEL` instead. It's kind of strange that this constant is defined to be NULL and the docs for `dispatch_get_queue_label` say not to pass in NULL, but in practice `DISPATCH_CURRENT_QUEUE_LABEL` is provided by the iOS SDK and works correctly. Test Plan: Set a breakpoint inside of `RCTCurrentThreadName` and inspect the name of the thread returned from `dispatch_get_queue_label`. Get valid-looking values like "com.facebook.React.RCTSettingsManagerQueue". Tested Cmd-R for good measure. The app refreshed fine without any crashes.
…UEUE_LABEL Summary: I encountered a crash when `RCTCurrentThreadName` called `dispatch_get_current_queue`. There are reports of it crashing e.g. CocoaLumberjack/CocoaLumberjack#108 so better not to call it at all, plus it is deprecated. Since we still want helpful debugging information, use `DISPATCH_CURRENT_QUEUE_LABEL` instead. It's kind of strange that this constant is defined to be NULL and the docs for `dispatch_get_queue_label` say not to pass in NULL, but in practice `DISPATCH_CURRENT_QUEUE_LABEL` is provided by the iOS SDK and works correctly. Closes facebook#1868 Github Author: James Ide <ide@jameside.com>
I know CocoaLumberjack is thread safe but I have been having this issue. Basically, I spawn off a thread using GCD
Within [WebServiceController getData] I call DDLogError when there is an error and this throws EXC_BAD_INSTRUCTION when running in the Simulator. On a device it throws EXC_BREAKPOINT(code=EXC_ARM_BREAKPOINT, subcode=0xdefe). Any suggestions for troubleshooting the issue?
The text was updated successfully, but these errors were encountered: