为什么semaphore_wait_trap会导致EXC_CRASH(SIGKILL)

时间:2016-09-23 20:02:13

标签: ios semaphore sigkill

我有一位iOS客户使用以下堆栈报告一致的崩溃错误:

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Triggered by Thread:  0

Filtered syslog:
None found


Thread 0 Crashed:
0   libsystem_kernel.dylib          0x000000018eb741a8 semaphore_wait_trap + 8
1   libdispatch.dylib               0x000000018ea5f7ec _dispatch_semaphore_wait_slow + 216
2   Scruff                          0x00000001003bf0fc -[TMCache setObject:forKey:] (TMCache.m:332)
3   Scruff                          0x00000001000c2a40 __44-[MSSProfileStreamingDataSource downloaded:]_block_invoke (MSSProfileStreamingDataSource.m:532)
4   libdispatch.dylib               0x000000018ea4d200 _dispatch_call_block_and_release + 24
5   libdispatch.dylib               0x000000018ea4d1c0 _dispatch_client_callout + 16
6   libdispatch.dylib               0x000000018ea51d6c _dispatch_main_queue_callback_4CF + 1000
7   CoreFoundation                  0x000000018fb71f2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
8   CoreFoundation                  0x000000018fb6fb18 __CFRunLoopRun + 1660
9   CoreFoundation                  0x000000018fa9e048 CFRunLoopRunSpecific + 444
10  GraphicsServices                0x0000000191521198 GSEventRunModal + 180
11  UIKit                           0x0000000195a77818 -[UIApplication _run] + 684
12  UIKit                           0x0000000195a72550 UIApplicationMain + 208
13  Scruff                          0x00000001000cc9b8 main (main.m:22)
14  libdyld.dylib                   0x000000018ea805b8 start + 4

有人可以准确解释semaphore_wait_trap正在做什么,以及它会在什么条件下触发EXEC_CRASHSIGKILL表示其他人触发了杀戮 - 这是否意味着iOS正在杀死该应用,因为信号量等待时间太长了?

以下是TMCache的问题代码,即Tumblr cache library for iOS

- (void)setObject:(id <NSCoding>)object forKey:(NSString *)key
{
    if (!object || !key)
        return;

    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);

    [self setObject:object forKey:key block:^(TMCache *cache, NSString *key, id object) {
        dispatch_semaphore_signal(semaphore);
    }];

    dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

    #if !OS_OBJECT_USE_OBJC
    dispatch_release(semaphore);
    #endif
}

第332行是方法的最后一行,OS_OBJECT_USE_OBJC为真,所以我认为这次崩溃是因为dispatch_semaphore_wait

0 个答案:

没有答案