zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.78k stars 749 forks source link

Crash due to EXC_BAD_ACCESS KERN_INVALID_ADDRESS #680

Open lachtos opened 4 years ago

lachtos commented 4 years ago

:beetle: Description I have been having these crashes for the past three months (at least) on iOS in production. Mostly on iPad (76% cases). In my app, I have a screen where I load 6 short sounds and cycle through them, sometimes they are being played in quick succession (at least 50ms in-between). After analysing event logs just before the crash, it seems that it might be crashing due to this quick cycling through the sounds. However, I cannot reproduce the problem myself, I have tried just mindlessly playing the sounds in a loop for an extended period of time and it doesn't seem to crash.

Crash info from Crashlytics:

RNSound.m line 247
-[RNSound play:withCallback:]

Crashed: com.facebook.react.RNSoundQueue
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000815af5cd
-[RNSound play:withCallback:]

Crashed: com.facebook.react.RNSoundQueue
0  libobjc.A.dylib                0x20d4fa66 objc_msgSend + 5
1  CoreFoundation                 0x214bea23 -[__NSCFNumber compare:] + 162
2  CoreFoundation                 0x214be971 -[__NSCFNumber isEqualToNumber:] + 28
3  CoreFoundation                 0x214be93f -[__NSCFNumber isEqual:] + 58
4  CoreFoundation                 0x214be6db -[__NSDictionaryM setObject:forKey:] + 330
5  app-name                       0x1eb61f -[RNSound play:withCallback:] + 247 (RNSound.m:247)
6  CoreFoundation                 0x215ac4c4 __invoking___ + 68
7  CoreFoundation                 0x214d287d -[NSInvocation invoke] + 292
8  CoreFoundation                 0x214d62f7 -[NSInvocation invokeWithTarget:] + 50
9  app-name                       0x2213d5 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 572 (RCTModuleMethod.mm:572)
10 app-name                       0x2236d1 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&) + 220504
11 app-name                       0x22333b invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 219586
12 libdispatch.dylib              0x21115823 _dispatch_call_block_and_release + 10
13 libdispatch.dylib              0x21122423 _dispatch_queue_drain$VARIANT$mp + 1758
14 libdispatch.dylib              0x21121a61 _dispatch_queue_invoke$VARIANT$mp + 284
15 libdispatch.dylib              0x211245e9 _dispatch_root_queue_drain + 1560
16 libdispatch.dylib              0x21123fcd _dispatch_worker_thread3 + 96
17 libsystem_pthread.dylib        0x212d9b29 _pthread_wqthread + 1024
18 libsystem_pthread.dylib        0x212d9718 start_wqthread + 8

:beetle: What is the observed behavior? Can't reproduce so I'm not sure when it crashes.

:beetle: What is the expected behavior? Not crashing.

:beetle: Please post your code:

Shouldn't be relevant in this case

:bulb: Does the problem have a test case? x

:bulb: **Possible solution** x

:bulb: Is there a workaround? x

:bulb: If the bug is confirmed, would you be willing to create a pull request? I am not familiar with Obj-C

Is your issue with...

Are you using...

Which versions are you using?

Does the problem occur on...

If your problem is happening on a device, which device?

mklb commented 2 years ago

I do not know if this is related but I have a similar crash just in production (but it is not the same). I can not reproduce it as well. Crash report is from an iPhone 11 running iOS 15.0.0 and react-native-sound 0.11.0.

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000002682c5400

Crashed: com.apple.main-thread
0  libobjc.A.dylib    0x2bf0 objc_release + 16
1  MYAPP              0x15fa34 -[RNSound audioPlayerDidFinishPlaying:successfully:] + 89 (RNSound.m:89)
2  AVFAudio           0x42974 -[AVAudioPlayer(AVAudioPlayerPriv) finishedPlaying:] + 128
3  Foundation         0x3de0c __NSThreadPerformPerform + 232
balsikandar commented 1 year ago

@mklb were you able to find the cause of your crash? I have been seeing same crash in our production.

mklb commented 1 year ago

@balsikandar No I did not. Somehow I do not see a crash like this any more. I updated to 0.11.2 a while ago.

balsikandar commented 1 year ago

Thanks, @mklb I'll see if that helps. I'm currently using 0.11.0