expo: NSRangeException: expo-av crashes occasionally on iOS in standalone app

Summary

I get more and more sentry logs that my iOS app crashes when using expo-av.

NSRangeException
Cannot remove an observer <EXAVPlayerData 0x2825becb0> for the key path "timedMetadata" from <AVPlayerItem 0x281cc6a90> because it is not registered as an observer.

+0x073964
-[EXAVPlayerData _removeObserversForPlayerItem:]
(EXAVPlayerData.m:601)
+0x073850
-[EXAVPlayerData _removeObserversForPlayerItems]
(EXAVPlayerData.m:582)
+0x07373c
-[EXAVPlayerData _removeObservers]
(EXAVPlayerData.m:565)
+0x0740cc
-[EXAVPlayerData _addObserversForNewPlayer]
(EXAVPlayerData.m:678)
+0x071c70
__41-[EXAVPlayerData _finishLoadingNewPlayer]_block_invoke_2
(EXAVPlayerData.m:181)

What platform(s) does this occur on?

iOS

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 13.1 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.18.1 - /opt/homebrew/opt/node@16/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 8.19.2 - /opt/homebrew/opt/node@16/bin/npm Watchman: 2022.11.14.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1 IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.1/14B47b - /usr/bin/xcodebuild npmPackages: babel-preset-expo: ~9.2.1 => 9.2.2 expo: ~47.0.12 => 47.0.13 react: 18.1.0 => 18.1.0 react-dom: 18.1.0 => 18.1.0 react-native: 0.70.5 => 0.70.5 react-native-web: ~0.18.7 => 0.18.9 npmGlobalPackages: eas-cli: 3.1.1 expo-cli: 6.1.0 Expo Workflow: bare (just my testing environment - in reality I’m on managed)

Minimal reproducible example

Unfortunately, it is not reproducible for me. It occurs occasionally. It does not feel right to post this with a reproducible example but on the other hand the error log will help someone to track this down (or maybe just surround it with a try/catch block? tbh: I have no clue from iOS native files 😦. ).

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 4
  • Comments: 21 (15 by maintainers)

Most upvoted comments

Recon this will ever get resolved? We also experience it regularly in our Sentry logs still

@brentvatne I understand that a repro is missing, but I couldn’t, for my life, create a MRE to reproduce this. But our Sentry is full of this crash. I think this issue is still valid.

I am still digging. I thought I had a fix but it crashed, since addObserver and removeObserver are having a race condition, as they happen on different threads. I don’t know if its worth to search a fix. We should just tell our users to upgrade to iOS 16 😄

Ok, I kinda feel like this is happening only on iOS 15.7.