robotmedia / RMStore

A lightweight iOS library for In-App Purchases
Apache License 2.0
2.43k stars 450 forks source link

Crash in -[RMStore addProduct:] on OS X #149

Open kirbyt opened 9 years ago

kirbyt commented 9 years ago

I'm working on a Mac app that's in the Mac App Store. I've received a number of crash reports caused when adding a product to the _products dictionary. Unfortunately I've not been able to recreate the crash. I can see three possibility that could cause this part of the code to crash:

  1. _products does not exist.
  2. product.productIdentifier is nil.
  3. product is nil.

But honestly I don't see how any of the three would ever happen, and I'm at a loss as to why -[RMStore addProduct:] is crashing from time to time.

I've included the latest crash report below. Any suggestions on might be happenings and how to prevent the crasher is greatly appreciated.

Thanks,

-KIRBY

Date/Time: 2015-08-16 20:31:43 +0000 OS Version: Mac OS X 10.10.4 (14E46) Report Version: 104

Exception Type: SIGABRT Exception Codes: #0 at 0x7fff8d69c286 Crashed Thread: 6

Thread 0: 0 libsystem_kernel.dylib 0x00007fff8d6974de mach_msg_trap + 10 1 CoreFoundation 0x00007fff97f5beb4 CFRunLoopServiceMachPort + 211 2 CoreFoundation 0x00007fff97f5b37b CFRunLoopRun + 1370 3 CoreFoundation 0x00007fff97f5abd8 CFRunLoopRunSpecific + 295 4 HIToolbox 0x00007fff91cbf56f RunCurrentEventLoopInMode + 234 5 HIToolbox 0x00007fff91cbf2ea ReceiveNextEventCommon + 430 6 HIToolbox 0x00007fff91cbf12b _BlockUntilNextEventMatchingListInModeWithFilter + 70 7 AppKit 0x00007fff8e4138ab _DPSNextEvent + 977 8 AppKit 0x00007fff8e412e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 345 9 AppKit 0x00007fff8e408af3 -[NSApplication run] + 593 10 AppKit 0x00007fff8e385244 NSApplicationMain + 1831 11 **** 0x000000010b4f524d RVNValidateAndRunApplication (main.m:462) 12 **** 0x000000010b4f5fbd main (main.m:472) 13 **** 0x000000010b4f04c4 start + 51

Thread 1: 0 libsystem_kernel.dylib 0x00007fff8d69d232 kevent64 + 10 1 libdispatch.dylib 0x00007fff96247a6a _dispatch_mgr_thread + 51

Thread 2: 0 libsystem_kernel.dylib 0x00007fff8d69c94a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff9b59d40d start_wqthread + 12

Thread 3: 0 libsystem_kernel.dylib 0x00007fff8d69c94a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff9b59d40d start_wqthread + 12

Thread 4: 0 libsystem_kernel.dylib 0x00007fff8d69c94a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff9b59d40d start_wqthread + 12

Thread 5: 0 libsystem_kernel.dylib 0x00007fff8d69c94a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff9b59d40d start_wqthread + 12

Thread 6 Crashed: 0 libsystem_kernel.dylib 0x00007fff8d69c286 pthread_kill + 10 1 libsystem_c.dylib 0x00007fff949cdb53 abort + 128 2 libsystem_malloc.dylib 0x00007fff92dc91cb free + 427 3 CoreFoundation 0x00007fff97f33de2 rehashd + 353 4 CoreFoundation 0x00007fff97f33b5f -[NSDictionaryM setObject:forKey:] + 910 5 **** 0x000000010b5125ee -RMStore addProduct: 6 **** 0x000000010b512b5c -RMProductsRequestDelegate productsRequest:didReceiveResponse: 7 StoreKit 0x000000010b718eb7 -[SKProductsRequest handleFinishResponseForProducts:invalidIdentifiers:] + 133 8 StoreKit 0x000000010b719a28 -[SKRequest _sendFinishedForProducts:invalidIdentifiers:] + 26 9 StoreKit 0x000000010b7190a4 47-[SKProductsRequest issueRequestForIdentifier:]_block_invoke_3 + 54 10 libdispatch.dylib 0x00007fff96249323 _dispatch_call_block_and_release + 11 11 libdispatch.dylib 0x00007fff96244c13 _dispatch_client_callout + 7 12 libdispatch.dylib 0x00007fff96248365 _dispatch_queue_drain + 1099 13 libdispatch.dylib 0x00007fff96249ecc _dispatch_queue_invoke + 201 14 libdispatch.dylib 0x00007fff962476b7 _dispatch_root_queue_drain + 462 15 libdispatch.dylib 0x00007fff96255fe4 _dispatch_worker_thread3 + 90 16 libsystem_pthread.dylib 0x00007fff9b59f637 _pthread_wqthread + 728 17 libsystem_pthread.dylib 0x00007fff9b59d40d start_wqthread + 12

Thread 7: 0 libsystem_kernel.dylib 0x00007fff8d69c94a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff9b59d40d start_wqthread + 12

Thread 8: 0 libsystem_kernel.dylib 0x00007fff8d69c94a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff9b59d40d start_wqthread + 12

Thread 9: 0 libsystem_kernel.dylib 0x00007fff8d69c94a __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff9b59d40d start_wqthread + 12

Thread 10: 0 libsystem_kernel.dylib 0x00007fff8d6974de mach_msg_trap + 10 1 HockeySDK 0x000000010b81e403 exception_server_thread + 201 2 libsystem_pthread.dylib 0x00007fff9b59f268 _pthread_body + 130 3 libsystem_pthread.dylib 0x00007fff9b59f1e5 _pthread_start + 175 4 libsystem_pthread.dylib 0x00007fff9b59d41d thread_start + 12

Thread 11: 0 libsystem_kernel.dylib 0x00007fff8d6974de mach_msg_trap + 10 1 CoreFoundation 0x00007fff97f5beb4 CFRunLoopServiceMachPort + 211 2 CoreFoundation 0x00007fff97f5b37b CFRunLoopRun + 1370 3 CoreFoundation 0x00007fff97f5abd8 CFRunLoopRunSpecific + 295 4 AppKit 0x00007fff8e4db56b _NSEventThread + 136 5 libsystem_pthread.dylib 0x00007fff9b59f268 _pthread_body + 130 6 libsystem_pthread.dylib 0x00007fff9b59f1e5 _pthread_start + 175 7 libsystem_pthread.dylib 0x00007fff9b59d41d thread_start + 12

Thread 12: 0 libsystem_kernel.dylib 0x00007fff8d69c136 psynch_cvwait + 10 1 libc++.1.dylib 0x00007fff9150cc95 std::__1::condition_variable::wait(std::1::unique_lockstd::__1::mutex&) + 46 2 JavaScriptCore 0x00007fff963d6544 JSC::BlockAllocator::blockFreeingThreadMain() + 227 3 JavaScriptCore 0x00007fff963cbcff WTF::wtfThreadEntryPoint(void*) + 14 4 libsystem_pthread.dylib 0x00007fff9b59f268 _pthread_body + 130 5 libsystem_pthread.dylib 0x00007fff9b59f1e5 _pthread_start + 175 6 libsystem_pthread.dylib 0x00007fff9b59d41d thread_start + 12

Thread 13: 0 libsystem_kernel.dylib 0x00007fff8d69c136 psynch_cvwait + 10 1 libc++.1.dylib 0x00007fff9150cc95 std::__1::condition_variable::wait(std::1::unique_lockstd::__1::mutex&) + 46 2 JavaScriptCore 0x00007fff963d6adb JSC::GCThread::waitForNextPhase() + 170 3 JavaScriptCore 0x00007fff963d6938 JSC::GCThread::gcThreadMain() + 87 4 JavaScriptCore 0x00007fff963cbcff WTF::wtfThreadEntryPoint(void*) + 14 5 libsystem_pthread.dylib 0x00007fff9b59f268 _pthread_body + 130 6 libsystem_pthread.dylib 0x00007fff9b59f1e5 _pthread_start + 175 7 libsystem_pthread.dylib 0x00007fff9b59d41d thread_start + 12

Thread 14: 0 libsystem_kernel.dylib 0x00007fff8d69c136 psynch_cvwait + 10 1 libc++.1.dylib 0x00007fff9150cc95 std::__1::condition_variable::wait(std::1::unique_lockstd::__1::mutex&) + 46 2 JavaScriptCore 0x00007fff963d6adb JSC::GCThread::waitForNextPhase() + 170 3 JavaScriptCore 0x00007fff963d6938 JSC::GCThread::gcThreadMain() + 87 4 JavaScriptCore 0x00007fff963cbcff WTF::wtfThreadEntryPoint(void*) + 14 5 libsystem_pthread.dylib 0x00007fff9b59f268 _pthread_body + 130 6 libsystem_pthread.dylib 0x00007fff9b59f1e5 _pthread_start + 175 7 libsystem_pthread.dylib 0x00007fff9b59d41d thread_start + 12

Thread 15: 0 libsystem_kernel.dylib 0x00007fff8d69c136 psynch_cvwait + 10 1 libc++.1.dylib 0x00007fff9150cc95 std::__1::condition_variable::wait(std::1::unique_lockstd::__1::mutex&) + 46 2 JavaScriptCore 0x00007fff963d6adb JSC::GCThread::waitForNextPhase() + 170 3 JavaScriptCore 0x00007fff963d6938 JSC::GCThread::gcThreadMain() + 87 4 JavaScriptCore 0x00007fff963cbcff WTF::wtfThreadEntryPoint(void*) + 14 5 libsystem_pthread.dylib 0x00007fff9b59f268 _pthread_body + 130 6 libsystem_pthread.dylib 0x00007fff9b59f1e5 _pthread_start + 175 7 libsystem_pthread.dylib 0x00007fff9b59d41d thread_start + 12

Thread 16: 0 libsystem_kernel.dylib 0x00007fff8d6974de mach_msg_trap + 10 1 CoreFoundation 0x00007fff97f5beb4 CFRunLoopServiceMachPort + 211 2 CoreFoundation 0x00007fff97f5b37b __CFRunLoopRun + 1370 3 CoreFoundation 0x00007fff97f5abd8 CFRunLoopRunSpecific + 295 4 CFNetwork 0x00007fff99f7b220 +[NSURLConnection(Loader) _resourceLoadLoop:] + 433 5 Foundation 0x00007fff97918dc2 NSThreadmain + 1344 6 libsystem_pthread.dylib 0x00007fff9b59f268 _pthread_body + 130 7 libsystem_pthread.dylib 0x00007fff9b59f1e5 _pthread_start + 175 8 libsystem_pthread.dylib 0x00007fff9b59d41d thread_start + 12

Thread 6 crashed with X86-64 Thread State: rip: 0x00007fff8d69c286 rbp: 0x0000000110c4aa80 rsp: 0x0000000110c4aa58 rax: 0x0000000000000000 rbx: 0x0000000000000006 rcx: 0x0000000110c4aa58 rdx: 0x0000000000000000 rdi: 0x0000000000006a43 rsi: 0x0000000000000006 r8: 0x0000000000000001 r9: 0x0000000000000000 r10: 0x000000000c000000 r11: 0x0000000000000206 r12: 0x000000010b558000 r13: 0x0000000000000005 r14: 0x0000000110c4b000 r15: 0x0000000000000000 rflags: 0x0000000000000206 cs: 0x0000000000000007 fs: 0x0000000000000000 gs: 0x0000000000000000

catlan commented 8 years ago

Fixed with https://github.com/catlan/RMStore/commit/02033804d9579510d79b5f0d7555097937eadc7b