tanersener / react-native-ffmpeg

FFmpeg for react-native. Not maintained anymore. Superseded by FFmpegKit.
GNU General Public License v3.0
401 stars 52 forks source link

Problem with upgrading project to RN 0.62 #155

Closed leegould closed 4 years ago

leegould commented 4 years ago

Hi,

Great library, thank you hugely for your work on it.

Description I'm having a strange problem after trying to update react native in my app to 0.62.2. This involved a lot of changes to the xcode proj and pods, and lots of trying to get it building again. Most everything works now, except, I am getting an issue in react-native-ffmpeg which worked fine before the changes. If I remove the library from my app, it builds and works ok, if I reinstall it and pod install/rerun the app, when the bundler loads, the app immediately crashes. I am unsure if it is something in the xcode setup I have screwed up (likely), but wondered if you had seen any other reports like the error below.

I got the logs below from flipper. From the stacktrace, it seems to have a problem when trying to run this bit of code from mobile-ffmpeg

https://github.com/tanersener/mobile-ffmpeg/blob/master/ios/src/MobileFFmpegConfig.m#L207

Saying there are no items in the array, when the constructor runs for this lib.

Looks like it happens in a try catch, and I am not sure why this has suddenly started happening. I have looked at the changes from the upgrade to the xcode project for my app, there was a new linker flag (-Wl,-no_compact_unwind), a lot of changes to add swift 5, a setting for CLANG_ENABLE_MODULES = YES and some flags for DFB_SONARKIT_ENABLED. I don't think these are the culprit, but I don't know enough about them to be fair, and when I try removing them, I get problems building with the new ver of RN. The pod file changes mostly added a smeg load of new pods for flipper support.

I haven't tried a clean RN project with 0.62.2 yet. Next on the list.

Any help greatly appreciated.

Expected behavior Not crash on startup.

Current behavior The app crashes on startup.

Logs Application Specific Information: Terminating app due to uncaught exception 'NSRangeException', reason: ' -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' terminating with uncaught exception of type NSException abort() called CoreSimulator 704.12.1 - Device: iPhone 11 (047B29A6-B51E-4F1F-B9DA-3ECC13C686EB) - Runtime: iOS 13.4 (17E8260) - DeviceType: iPhone 11

Application Specific Backtrace 1: 0 CoreFoundation 0x000000010a1bef0e __exceptionPreprocess + 350 1 libobjc.A.dylib 0x0000000109df89b2 objc_exception_throw + 48 2 CoreFoundation 0x000000010a251a61 _CFThrowFormattedException + 194 3 CoreFoundation 0x000000010a0d27de -[__NSArrayM objectAtIndex:] + 142 4 spotters 0x0000000101b0e837 callbackDataRemove + 55 5 spotters 0x0000000101b0ed21 callbackBlockFunction + 529 6 libdispatch.dylib 0x000000010bfd1951 _dispatch_call_block_and_release + 12 7 libdispatch.dylib 0x000000010bfd28cb _dispatch_client_callout + 8 8 libdispatch.dylib 0x000000010bfd4922 _dispatch_queue_override_invoke + 834 9 libdispatch.dylib 0x000000010bfe1cc5 _dispatch_root_queue_drain + 350 10 libdispatch.dylib 0x000000010bfe246a _dispatch_worker_thread2 + 102 11 libsystem_pthread.dylib 0x000000010c4589f7 _pthread_wqthread + 220 12 libsystem_pthread.dylib 0x000000010c457b77 start_wqthread + 15

Thread 3 Crashed:: Dispatch queue: com.apple.root.default-qos 0 libsystem_kernel.dylib 0x0000000115a9533a pthread_kill + 10 1 libsystem_pthread.dylib 0x0000000115af2e60 pthread_kill + 430 2 libsystem_c.dylib 0x0000000115817b7c abort + 120 3 libc++abi.dylib 0x0000000113576858 abort_message + 231 4 libc++abi.dylib 0x0000000113567cbf demangling_terminate_handler() + 262 5 libobjc.A.dylib 0x000000011338ac0b _objc_terminate() + 96 6 libc++abi.dylib 0x0000000113575c87 std::terminate(void (*)()) + 8 7 libc++abi.dylib 0x000000011357840b cxxabiv1::failed_throw(cxxabiv1::__cxa_exception*) + 27 8 libc++abi.dylib 0x00000001135783d2 cxa_throw + 113 9 libobjc.A.dylib 0x000000011338aad6 objc_exception_throw + 340 10 com.apple.CoreFoundation 0x0000000113a98a61 _CFThrowFormattedException + 194 11 com.apple.CoreFoundation 0x00000001139197de -[NSArrayM objectAtIndex:] + 142 12 com.spottersapp 0x000000010a8205a7 callbackDataRemove + 55 (MobileFFmpegConfig.m:207) 13 com.spottersapp 0x000000010a820a91 callbackBlockFunction + 529 (MobileFFmpegConfig.m:275) 14 libdispatch.dylib 0x0000000115671951 _dispatch_call_block_and_release + 12 15 libdispatch.dylib 0x00000001156728cb _dispatch_client_callout + 8 16 libdispatch.dylib 0x0000000115674922 _dispatch_queue_override_invoke + 834 17 libdispatch.dylib 0x0000000115681cc5 _dispatch_root_queue_drain + 350 18 libdispatch.dylib 0x000000011568246a _dispatch_worker_thread2 + 102 19 libsystem_pthread.dylib 0x0000000115aef9f7 _pthread_wqthread + 220 20 libsystem_pthread.dylib 0x0000000115aeeb77 start_wqthread + 15

Environment

Thanks for any pointers.

tanersener commented 4 years ago
  1. Do you have any breakpoints enabled on Xcode? Can you try by disabling them all? It is possible to configure Xcode to break on all caught/uncaught exceptions. This can be the reason of this error. That behaviour can be seen from the screenshots in this http://blog.manbolo.com/2012/01/23/xcode-tips-1-break-on-exceptions page.
  2. Can you list steps I can use to reproduce this issue?
  3. What happens when you run react-native run-ios
leegould commented 4 years ago

Thanks for responding so fast.

I had a check and made sure there are no breakpoints in xcode. Good thought.

when I run react-native run-ios, it builds and deploys to the simulator fine. The bundler does it's thing and it crashes when the bundler has finished loading.

I can't repeat it in an empty project. I just finished making a new react native project with the latest version and installing the lib, and that all works fine, so it is something I have done in the upgrade. I will compare the clean project tomorrow, see if there is anything I am missing, otherwise will try the upgrade from the start again. Will let you know if I find how to repeat it.

Thanks for the suggestions!

leegould commented 4 years ago

Just an update on this if anyone else ends up here, I got this working today after re migrating to the newest RN version step by step and finding when it broke. Adding the flipper libs cause a lot of build warnings in xcode saying 'Could not create compact unwind for library: stack subl instruction is too different from dwarf stack size', which I had tried to fix by adding the linker flag '-Wl,-no_compact_unwind'. This is what caused the above, and I can repeat it on a clean project. Not really related to this library I think. So I have removed this setting for now and left the warnings unfixed. React native upgrades are always such a blast! ;)

Thanks again for this lib, it is great :)