facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.83k stars 24.29k forks source link

RCTAssert failing on react-native-background-downloader #32298

Closed sidferreira closed 7 months ago

sidferreira commented 3 years ago

Description

So, this issue started a few days ago (probably after XCode 13), happens consistently but I still trying to figure out why exactly it happens. I tried to create a project to reproduce it consistently but it just doesn't happen.

It is important to mention that, if I comment out that block, the apps work just fine.

The error is triggered at https://github.com/facebook/react-native/blob/7100756bb8b0b1ac85ccaa32c0ce5c1cc70d524f/React/Base/RCTModuleMethod.mm#L527-L528

If I clean all cache and stuff, sometimes it works OK, but after a reload on the simulator, it starts throwing this error:

App[88472:7568803] *** Assertion failure in -[RCTModuleMethod invokeWithBridge:module:arguments:](), /.../App/node_modules/react-native/React/Base/RCTModuleMethod.mm:528
2021-09-29 13:53:50.255426-0700 App[88472:7568803] [native] Exception 'Attempted to invoke method             -[RNBackgroundDownloader download:] on a module of class fir_8EBD1464-921D-4708-B673-8F06AAF63A4F_RNBackgroundDownloader' was thrown while invoking download on target RNBackgroundDownloader with params (
        {
        destination = "/.../Library/Developer/CoreSimulator/Devices/8A0FC96C-EA14-4BE2-B2BE-E4526A7A1C53/data/Containers/Shared/AppGroup/F88525CB-C357-473C-B244-820AC80CF723/www/downloads/....mp4";
        headers =         {
        };
        id = ...;
        url = ...;
    }
)
callstack: (
    0   CoreFoundation                      0x00007fff203fbbb4 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff2019ebe7 objc_exception_throw + 48
    2   Foundation                          0x00007fff20750da9 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0
    3   App                             0x000000010da92dfc -[RCTModuleMethod invokeWithBridge:module:arguments:] + 780
    4   App                             0x000000010da9713e _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 750
    5   App                             0x000000010da96c91 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 113
    6   App                             0x000000010da96c19 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
    7   libdispatch.dylib                   0x0000000110ea8a28 _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x0000000110ea9c0c _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x0000000110eb060f _dispatch_lane_serial_drain + 858
    10  libdispatch.dylib                   0x0000000110eb12fe _dispatch_lane_invoke + 436
    11  libdispatch.dylib                   0x0000000110ebd59b _dispatch_workloop_worker_thread + 900
    12  libsystem_pthread.dylib             0x00007fff6bfeb45d _pthread_wqthread + 314
    13  libsystem_pthread.dylib             0x00007fff6bfea42f start_wqthread + 15

React Native version:

System:
    OS: macOS 11.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 145.53 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.22.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.12 - /usr/local/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /Users/.../.rvm/gems/ruby-2.7.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 19, 23, 25, 27, 28, 29, 30, 31
      Build Tools: 19.1.0, 23.0.1, 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 31.0.0
      System Images: android-23 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-28 | Automotive Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-28 | Polestar 2, android-29 | Automotive with Play Store Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-29 | Volvo XC40, android-29 | Polestar 2, android-30 | Android TV Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: 21.3.6528147
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Java: javac 14 - /usr/local/opt/jenv/shims/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Still can't reproduce it in any other project. To be honest the issue itself is weird. Hints for debugging are welcome.

ljbatwh commented 2 years ago

I also met the same issue. any update?

sidferreira commented 2 years ago

@ljbatwh no, and as the repo was archived, I may create a clone, with renovated code, trying to address it.

ljbatwh commented 2 years ago

Thanks. I found some information, the RNBackgroundDownloader will be swizzled by firebase. the prefix "fir" represent the firebase.. the readme will give more information about this. So comment out the RCTAssert in RCTModuleMothod.m should be a effective workaround. But, a better solution need help :) @sidferreira

sidferreira commented 2 years ago

@liamjones thanks!!! Will check on that. I've been patching it locally as well.

github-actions[bot] commented 7 months ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

sidferreira commented 7 months ago

I moved from that job, closing.