react-native-sound icon indicating copy to clipboard operation
react-native-sound copied to clipboard

Fatal Exception: NSGenericException: "was mutated while being enumerated"

Open itinance opened this issue 10 years ago • 4 comments

I want just to inform about this exception we've got. Maybe others are looking for it also and can give better feedback than me.

This exception isn't straight reproducable, but occurs from time to time when multiple sounds was played one after another in our app.

Versions:

"react-native": "0.26.2",
"react-native-sound": "^0.8.3",

The Exception:

Fatal Exception: NSGenericException
Collection <__NSDictionaryM: 0x16018f740> was mutated while being enumerated.

Callstack (small list):
-[RNSound keyForPlayer:]
-[RNSound audioPlayerDidFinishPlaying:successfully:]

The whole Callstack (taken from Crashlytics):

Fatal Exception: NSGenericException
Collection <__NSDictionaryM: 0x16018f740> was mutated while being enumerated.

Callstack (small list):
-[RNSound keyForPlayer:]
-[RNSound audioPlayerDidFinishPlaying:successfully:]

The whole Callstack (taken from Crashlytics):

# Crashlytics - plaintext stacktrace downloaded by Hagen Hübel at Tue, 09 Aug 2016 14:57:40 GMT
# Platform: ios
# Version: 1.18 (73)
# Issue #: 6
# Issue ID: 57a9ee07ffcdc04250571b51
# Session ID: 82cfb8bd763a4678879093efec533e8b
# Date: 2016-08-09T14:51:31Z
# OS Version: 9.3.2 (13F69)
# Device: iPhone 6
# RAM Free: 7.3%
# Disk Free: 3.8%

#0. Crashed: com.twitter.crashlytics.ios.exception
0  MyApp                      0x1000df788 CLSProcessRecordAllThreads + 4296570760
1  MyApp                      0x1000df788 CLSProcessRecordAllThreads + 4296570760
2  MyApp                      0x1000df644 CLSProcessRecordAllThreads + 4296570436
3  MyApp                      0x1000cfe04 CLSHandler + 4296506884
4  MyApp                      0x1000dd85c __CLSExceptionRecord_block_invoke + 4296562780
5  libdispatch.dylib              0x18311947c _dispatch_client_callout + 16
6  libdispatch.dylib              0x183124728 _dispatch_barrier_sync_f_invoke + 100
7  MyApp                      0x1000dd300 CLSExceptionRecord + 4296561408
8  MyApp                      0x1000dd134 CLSExceptionRecordNSException + 4296560948
9  MyApp                      0x1000dcd54 CLSTerminateHandler() + 4296559956
10 libc++abi.dylib                0x182d26f44 std::__terminate(void (*)()) + 16
11 libc++abi.dylib                0x182d26b10 __cxa_rethrow + 144
12 libobjc.A.dylib                0x182d34120 objc_exception_rethrow + 44
13 CoreFoundation                 0x1835accf8 CFRunLoopRunSpecific + 552
14 GraphicsServices               0x184e94088 GSEventRunModal + 180
15 UIKit                          0x188896088 UIApplicationMain + 204
16 MyApp                      0x10004bd50 main (main.m:16)
17 libdispatch.dylib              0x18314a8b8 (Missing)

--

Fatal Exception: NSGenericException
0  CoreFoundation                 0x1836cedb0 __exceptionPreprocess
1  libobjc.A.dylib                0x182d33f80 objc_exception_throw
2  CoreFoundation                 0x1836ce7e4 -[NSException name]
3  CoreFoundation                 0x183607c64 -[NSDictionary allKeysForObject:]
4  MyApp                      0x100120210 -[RNSound keyForPlayer:]
5  MyApp                      0x100120380 -[RNSound audioPlayerDidFinishPlaying:successfully:]
6  Foundation                     0x1840a402c __NSThreadPerformPerform
7  CoreFoundation                 0x18368509c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
8  CoreFoundation                 0x183684b30 __CFRunLoopDoSources0
9  CoreFoundation                 0x183682830 __CFRunLoopRun
10 CoreFoundation                 0x1835acc50 CFRunLoopRunSpecific
11 GraphicsServices               0x184e94088 GSEventRunModal
12 UIKit                          0x188896088 UIApplicationMain
13 MyApp                      0x10004bd50 main (main.m:16)
14 libdispatch.dylib              0x18314a8b8 (Missing)

#0. Crashed: com.twitter.crashlytics.ios.exception
0  MyApp                      0x1000df788 CLSProcessRecordAllThreads + 4296570760
1  MyApp                      0x1000df788 CLSProcessRecordAllThreads + 4296570760
2  MyApp                      0x1000df644 CLSProcessRecordAllThreads + 4296570436
3  MyApp                      0x1000cfe04 CLSHandler + 4296506884
4  MyApp                      0x1000dd85c __CLSExceptionRecord_block_invoke + 4296562780
5  libdispatch.dylib              0x18311947c _dispatch_client_callout + 16
6  libdispatch.dylib              0x183124728 _dispatch_barrier_sync_f_invoke + 100
7  MyApp                      0x1000dd300 CLSExceptionRecord + 4296561408
8  MyApp                      0x1000dd134 CLSExceptionRecordNSException + 4296560948
9  MyApp                      0x1000dcd54 CLSTerminateHandler() + 4296559956
10 libc++abi.dylib                0x182d26f44 std::__terminate(void (*)()) + 16
11 libc++abi.dylib                0x182d26b10 __cxa_rethrow + 144
12 libobjc.A.dylib                0x182d34120 objc_exception_rethrow + 44
13 CoreFoundation                 0x1835accf8 CFRunLoopRunSpecific + 552
14 GraphicsServices               0x184e94088 GSEventRunModal + 180
15 UIKit                          0x188896088 UIApplicationMain + 204
16 MyApp                      0x10004bd50 main (main.m:16)
17 libdispatch.dylib              0x18314a8b8 (Missing)

#1. com.apple.libdispatch-manager
0  libsystem_kernel.dylib         0x1832694d8 kevent_qos + 8
1  libdispatch.dylib              0x18312c7d8 _dispatch_mgr_invoke + 232
2  libdispatch.dylib              0x18311b648 _dispatch_source_invoke + 50

#2. com.twitter.crashlytics.ios.MachExceptionServer
0  libsystem_kernel.dylib         0x18324cfd8 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18324ce54 mach_msg + 72
2  MyApp                      0x1000cac64 CLSMachExceptionServer + 4296485988
3  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
4  libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
5  libsystem_pthread.dylib        0x183331028 thread_start + 4

#3. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x18324cfd8 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18324ce54 mach_msg + 72
2  CoreFoundation                 0x183684c60 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x183682964 __CFRunLoopRun + 1032
4  CoreFoundation                 0x1835acc50 CFRunLoopRunSpecific + 384
5  CFNetwork                      0x183d2dc68 +[NSURLConnection(Loader) _resourceLoadLoop:] + 412
6  Foundation                     0x1840a3e4c __NSThread__start__ + 1000
7  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
8  libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
9  libsystem_pthread.dylib        0x183331028 thread_start + 4

#4. com.facebook.react.JavaScript
0  libsystem_kernel.dylib         0x18324cfd8 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18324ce54 mach_msg + 72
2  CoreFoundation                 0x183684c60 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x183682964 __CFRunLoopRun + 1032
4  CoreFoundation                 0x1835acc50 CFRunLoopRunSpecific + 384
5  MyApp                      0x100093094 +[RCTJSCExecutor runRunLoopThread] + 4296257684
6  Foundation                     0x1840a3e4c __NSThread__start__ + 1000
7  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
8  libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
9  libsystem_pthread.dylib        0x183331028 thread_start + 4

#5. JavaScriptCore::Marking
0  libsystem_kernel.dylib         0x183267f24 __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x183332ce8 _pthread_cond_wait + 648
2  libc++.1.dylib                 0x182cbf42c std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 56
3  JavaScriptCore                 0x1870812cc JSC::GCThread::waitForNextPhase() + 144
4  JavaScriptCore                 0x187081364 JSC::GCThread::gcThreadMain() + 84
5  JavaScriptCore                 0x186d56f14 WTF::threadEntryPoint(void*) + 212
6  JavaScriptCore                 0x186d56e24 WTF::wtfThreadEntryPoint(void*) + 24
7  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
8  libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
9  libsystem_pthread.dylib        0x183331028 thread_start + 4

#6. GAIThread
0  libsystem_kernel.dylib         0x18324cfd8 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18324ce54 mach_msg + 72
2  CoreFoundation                 0x183684c60 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x183682964 __CFRunLoopRun + 1032
4  CoreFoundation                 0x1835acc50 CFRunLoopRunSpecific + 384
5  Foundation                     0x183fbccfc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308
6  Foundation                     0x184012030 -[NSRunLoop(NSRunLoop) run] + 88
7  MyApp                      0x100142378 +[GAI threadMain:] + 4296975224
8  Foundation                     0x1840a3e4c __NSThread__start__ + 1000
9  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
10 libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
11 libsystem_pthread.dylib        0x183331028 thread_start + 4

#7. AVAudioSession Notify Thread
0  libsystem_kernel.dylib         0x18324cfd8 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18324ce54 mach_msg + 72
2  CoreFoundation                 0x183684c60 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x183682964 __CFRunLoopRun + 1032
4  CoreFoundation                 0x1835acc50 CFRunLoopRunSpecific + 384
5  libAVFAudio.dylib              0x189d259e0 GenericRunLoopThread::Entry(void*) + 164
6  libAVFAudio.dylib              0x189cfa75c CAPThread::Entry(CAPThread*) + 84
7  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
8  libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
9  libsystem_pthread.dylib        0x183331028 thread_start + 4

#8. com.apple.CFSocket.private
0  libsystem_kernel.dylib         0x183268344 __select + 8
1  CoreFoundation                 0x18368b1c8 __CFSocketManager + 648
2  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
3  libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
4  libsystem_pthread.dylib        0x183331028 thread_start + 4

#9. com.apple.coreaudio.AQClient
0  libsystem_kernel.dylib         0x18324cfd8 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18324ce54 mach_msg + 72
2  CoreFoundation                 0x183684c60 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x183682964 __CFRunLoopRun + 1032
4  CoreFoundation                 0x1835acc50 CFRunLoopRunSpecific + 384
5  AudioToolbox                   0x185ec89f4 GenericRunLoopThread::Entry(void*) + 164
6  AudioToolbox                   0x185ebad70 CAPThread::Entry(CAPThread*) + 124
7  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
8  libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
9  libsystem_pthread.dylib        0x183331028 thread_start + 4

#10. Thread
0  libsystem_kernel.dylib         0x183268b48 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x183331530 _pthread_wqthread + 1284
2  libsystem_pthread.dylib        0x183331020 start_wqthread + 4

#11. com.facebook.react.RNSoundQueue
0  libsystem_kernel.dylib         0x18324cfd8 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x18324ce54 mach_msg + 72
2  AudioToolbox                   0x185ed0fd4 AQClient_Start + 164
3  AudioToolbox                   0x185ed0eb4 AudioQueueStart + 216
4  libAVFAudio.dylib              0x189cf2648 AVAudioPlayerCpp::playQueue(AudioTimeStamp const*) + 288
5  libAVFAudio.dylib              0x189cf0f94 AVAudioPlayerCpp::play() + 76
6  libAVFAudio.dylib              0x189cefc70 -[AVAudioPlayer play] + 52
7  MyApp                      0x100120c58 -[RNSound play:withCallback:] + 4296838232
8  CoreFoundation                 0x1836d4a60 __invoking___ + 144
9  CoreFoundation                 0x1835cc488 -[NSInvocation invoke] + 284
10 CoreFoundation                 0x1835d0db0 -[NSInvocation invokeWithTarget:] + 60
11 MyApp                      0x100079e14 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 4296154644
12 MyApp                      0x10009b35c -[RCTBatchedBridge _handleRequestNumber:moduleID:methodID:params:] + 4296291164
13 MyApp                      0x10009ad50 __33-[RCTBatchedBridge handleBuffer:]_block_invoke.319 + 4296289616
14 libdispatch.dylib              0x1831194bc _dispatch_call_block_and_release + 24
15 libdispatch.dylib              0x18311947c _dispatch_client_callout + 16
16 libdispatch.dylib              0x1831254c0 _dispatch_queue_drain + 864
17 libdispatch.dylib              0x18311cf80 _dispatch_queue_invoke + 464
18 libdispatch.dylib              0x18311947c _dispatch_client_callout + 16
19 libdispatch.dylib              0x183127914 _dispatch_root_queue_drain + 2140
20 libdispatch.dylib              0x1831270b0 _dispatch_worker_thread3 + 112
21 libsystem_pthread.dylib        0x183331470 _pthread_wqthread + 1092
22 libsystem_pthread.dylib        0x183331020 start_wqthread + 4

#12. Thread
0  libsystem_kernel.dylib         0x183268b48 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x183331530 _pthread_wqthread + 1284
2  libsystem_pthread.dylib        0x183331020 start_wqthread + 4

#13. Thread
0  libsystem_kernel.dylib         0x18326841c __semwait_signal + 8
1  libsystem_c.dylib              0x18318522c nanosleep + 212
2  libc++.1.dylib                 0x182cfd3b4 std::__1::this_thread::sleep_for(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&) + 84
3  JavaScriptCore                 0x1872ce690 bmalloc::Heap::scavenge(std::__1::unique_lock<bmalloc::StaticMutex>&, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000l> >) + 188
4  JavaScriptCore                 0x1872ce340 bmalloc::Heap::concurrentScavenge() + 84
5  JavaScriptCore                 0x1872d0ad8 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::entryPoint() + 100
6  JavaScriptCore                 0x1872d0a68 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::pthreadEntryPoint(void*) + 12
7  libsystem_pthread.dylib        0x183333b28 _pthread_body + 156
8  libsystem_pthread.dylib        0x183333a8c _pthread_body + 154
9  libsystem_pthread.dylib        0x183331028 thread_start + 4

#14. Thread
0  libsystem_kernel.dylib         0x183268b48 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x183331530 _pthread_wqthread + 1284
2  libsystem_pthread.dylib        0x183331020 start_wqthread + 4

itinance avatar Aug 09 '16 15:08 itinance

Thanks for the report. I can't see any enumeration in the current codebase so hopefully this issue has been fixed since your issue came up.

Closing. Let me know if this comes up again and I'll reopen and investigate.

benvium avatar Feb 10 '17 09:02 benvium

One of my users had this same crash (using react-native-sound 0.10.4). Seems not to be a major issue, but still exists.

mitchellmcm27 avatar Jan 25 '18 17:01 mitchellmcm27

This is also happening for our users on 0.10.4

Fatal Exception: NSGenericException
0  CoreFoundation                 0x184947164 __exceptionPreprocess
1  libobjc.A.dylib                0x183b90528 objc_exception_throw
2  CoreFoundation                 0x1849467f0 -[__NSSingleObjectEnumerator initWithObject:]
3  CoreFoundation                 0x184869828 -[NSDictionary allKeysForObject:]
4  lingokids                      0x100d3e1e8 -[RNSound keyForPlayer:] (RNSound.m:33)
5  lingokids                      0x100d3e370 -[RNSound audioPlayerDidFinishPlaying:successfully:] (RNSound.m:46)
6  Foundation                     0x1853432e4 __NSThreadPerformPerform
7  CoreFoundation                 0x1848ef77c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
8  CoreFoundation                 0x1848ef6fc __CFRunLoopDoSource0
9  CoreFoundation                 0x1848eef84 __CFRunLoopDoSources0
10 CoreFoundation                 0x1848ecb5c __CFRunLoopRun
11 CoreFoundation                 0x18480cc58 CFRunLoopRunSpecific
12 GraphicsServices               0x1866b8f84 GSEventRunModal
13 UIKit                          0x18df655c4 UIApplicationMain
14 lingokids                      0x1003a9810 main (main.mm:33)
15 libdyld.dylib                  0x18432c56c start

awinograd avatar Mar 02 '18 16:03 awinograd

Fatal Exception: NSGenericException *** Collection <__NSDictionaryM: 0x283c124c0> was mutated while being enumerated. RNSound keyForPlayer - this error is still alive, stably appears

abaddonGIT avatar Mar 07 '19 00:03 abaddonGIT