问题
I'm hitting a race-condition in my app, where all or all but 1 threads get stuck on syscall_thread_switch whenever I pause debugging. It reproduces much more often on the simulator, but also on the iPad Air. There is ALWAYS at least 2 threads stuck in CocoaLumberjack's queueLogMessage: -- see screenshots.
I've never seen this before on 8.1 and 8.2, but i'm hitting it often on 8.3. I'm not claiming this is an 8.3 bug :)
This is a level of complexity i've never had to debug before, so i'm not sure what to do. I hope I'm providing enough information, please let me know if you need more (please be specific about how to get the information if it isn't dead clear). Can you please help me debug this?! Millions of thanks.
回答1:
I hit a similar issue with NSOperations in a NSOperationQueue in iOS 8.3 (not related to CocoaLumberjack). I had concurrent operations creating their own threads, which is no-longer needed. It behaved perfectly well in 8.2, but not 8.3.
In the start method I simply replaced:
[NSThread detachNewThreadSelector:@selector(main) toTarget:self withObject:nil];
With:
[self main];
来源:https://stackoverflow.com/questions/29624696/syscall-thread-switch-ios-8-3-race-cocoalumberjack-bug-how-to-debug-this