Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 13 and above EXC_BAD_ACCESS KERN_INVALID_ADDRESS acebook::react::Instance::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) #26985

Closed
nidongara opened this issue Oct 24, 2019 · 49 comments
Labels
Bug Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Newer Patch Available Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@nidongara
Copy link

nidongara commented Oct 24, 2019

This started happening after iOS 13 was release. I started seeing a lot of crashes in productions with this in my fabric logs.

Crashed: com.apple.root.user-interactive-qos 0 member_mobile_update_prod 0x100172910 facebook::react::Instance::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 414720 1 member_mobile_update_prod 0x100172bec facebook::react::Instance::loadScriptFromString(std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool) + 415452 2 member_mobile_update_prod 0x1000fe1ec __51-[RCTCxxBridge executeApplicationScript:url:async:]_block_invoke + 4305887724 3 member_mobile_update_prod 0x100120148 facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 76856 4 member_mobile_update_prod 0x1000f8474 -[RCTCxxBridge _tryAndHandleError:] + 4305863796 5 member_mobile_update_prod 0x1000fdee8 -[RCTCxxBridge executeApplicationScript:url:async:] + 4305886952 6 member_mobile_update_prod 0x1000fdcdc -[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 4305886428 7 member_mobile_update_prod 0x1000fba20 -[RCTCxxBridge executeSourceCode:sync:] + 4305877536 8 member_mobile_update_prod 0x1000f927c __21-[RCTCxxBridge start]_block_invoke_2 + 4305867388 9 libdispatch.dylib 0x18f28fbb0 _dispatch_call_block_and_release + 32 10 (Missing) 0x3d3a84818f291000 (Missing) 11 (Missing) 0x0 (Missing) 12 (Missing) 0x0 (Missing) 13 (Missing) 0x177bf7018f2f6a00 (Missing) 14 (Missing) 0x0 (Missing)

React Native version:

React Native Environment Info:
System:
  OS: macOS 10.14.6
  CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Memory: 33.30 MB / 16.00 GB
  Shell: 3.2.57 - /bin/bash
Binaries:
  Node: 10.8.0 - ~/.nvm/versions/node/v10.8.0/bin/node
  Yarn: 1.13.0 - ~/.nvm/versions/node/v10.8.0/bin/yarn
  npm: 6.10.2 - ~/.nvm/versions/node/v10.8.0/bin/npm
  Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
  iOS SDK:
    Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
IDEs:
  Android Studio: 3.3 AI-182.5107.16.33.5264788
  Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
npmPackages:
  react: 16.8.3 => 16.8.3 
  react-native: 0.59.10 => 0.59.10 
npmGlobalPackages:
  react-native-cli: 2.0.1

Steps To Reproduce

  1. I am not able to reproduce this but similar issue was found in 0.59.5 in iOS so we upgraded to 0.59.10 thinking it will fix the issue but it is still happening in production.

I cannot updated to latest RN because of Android X changes.

@nidongara nidongara added the Bug label Oct 24, 2019
@react-native-bot react-native-bot added Platform: iOS iOS applications. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. Resolution: Old Version labels Oct 24, 2019
@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.61 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running `react-native info` on a project using the latest release.

@oleksandr-dziuban
Copy link

oleksandr-dziuban commented Oct 27, 2019

I have same issue on react-native 0.61.2 on iOS 13
#26746

@rostislav-simonik
Copy link
Contributor

Can confirm, the same issue with 0.61.2

@nikechanhk
Copy link

same issue with 0.59.9

@oleksandr-dziuban
Copy link

iOS 13.2 fixes this issue

@nikechanhk
Copy link

iOS 13.2 fixes this issue

Seems not work for my case. still crash with same reason on ios 13.2 with rn 0.59.9

@nikechanhk
Copy link

It looks like you are using an older version of React Native. Please update to the latest release, v0.61 and verify if the issue still exists.

Just tested with rn 0.61.3. Still face the same problem in production only

@oleksandr-dziuban
Copy link

@nikechanhk Try react-native 0.61.3. I'm on it and iOS 13.2. App looks good, don't receive any crashes anymore in crash reports

@nikechanhk
Copy link

@nikechanhk Try react-native 0.61.3. I'm on it and iOS 13.2. App looks good, don't receive any crashes anymore in crash reports

using 0.61.3 already. still crash with same reason

@nikechanhk
Copy link

It seems iphone 11 family have higher opportunity rate hit this issue.

@kennym
Copy link

kennym commented Nov 8, 2019

@oleksandr-dziuban @nikechanhk - we're experiencing a highly similar issue and we're on RN 0.61.4 - we get it both on iOS 12 and 13.

These are the logs:

EXC_BAD_ACCESS Attempted to dereference garbage pointer 0xe1eb70b2b0c0. 
    /Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/ReactCommon/cxxreact/Instance.cpp:61:14 loadApplication
    /Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/ReactCommon/cxxreact/Instance.cpp:95:5 loadScriptFromString
    /Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:1336:29 __51-[RCTCxxBridge executeApplicationScript:url:async:]_block_invoke
    /Applications/Xcode_11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1799:16 facebook::react::tryAndReturnError(std::__1::function<void ()> const&)
    /Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:276:20 -[RCTCxxBridge _tryAndHandleError:]
    /Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:1319:3 -[RCTCxxBridge executeApplicationScript:url:async:]
    /Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:1299:3 -[RCTCxxBridge enqueueApplicationScript:url:onComplete:]
    /Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:915:5 -[RCTCxxBridge executeSourceCode:sync:]
    /Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:390:7 __21-[RCTCxxBridge start]_block_invoke_2
    /usr/lib/system/libdispatch.dylib __dispatch_call_block_and_release
    /usr/lib/system/libdispatch.dylib __dispatch_client_callout
    /usr/lib/system/libdispatch.dylib __dispatch_root_queue_drain
    /usr/lib/system/libdispatch.dylib __dispatch_worker_thread2
    /usr/lib/system/libsystem_pthread.dylib __pthread_wqthread

The error was reported from this thread:

/Applications/Xcode_11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3934:56facebook::react::Instance::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)	
/Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/ReactCommon/cxxreact/Instance.cpp:95:5loadScriptFromString	
/Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/ReactCommon/cxxreact/Instance.cpp:95:5loadScriptFromString	
/Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:1336:29__51-[RCTCxxBridge executeApplicationScript:url:async:]_block_invoke	
/Applications/Xcode_11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1799:16facebook::react::tryAndReturnError(std::__1::function<void ()> const&)	
/Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:276:20-[RCTCxxBridge _tryAndHandleError:]	
/Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:1319:3-[RCTCxxBridge executeApplicationScript:url:async:]	
/Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:1299:3-[RCTCxxBridge enqueueApplicationScript:url:onComplete:]	
/Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:915:5-[RCTCxxBridge executeSourceCode:sync:]	
/Users/runner/runners/2.160.0/work/1/s/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:390:7__21-[RCTCxxBridge start]_block_invoke_2	
/usr/lib/system/libdispatch.dylib__dispatch_call_block_and_release	
/usr/lib/system/libdispatch.dylib__dispatch_client_callout	
/usr/lib/system/libdispatch.dylib__dispatch_root_queue_drain	
/usr/lib/system/libdispatch.dylib__dispatch_worker_thread2	
/usr/lib/system/libsystem_pthread.dylib__pthread_wqthread

@nidongara
Copy link
Author

still having the same issue with 13.2 iOS. Was anyone able to reproduce this on a simulator?

@nidongara
Copy link
Author

@kennym does it crash always on load?

@kennym
Copy link

kennym commented Nov 15, 2019

@nidongara yes, the crash always immediately happens after app load.

@nidongara
Copy link
Author

@kennym for me it happens 1 out out 20 times. I am not able to reproduce this in my simulator or test devices.

@kennym
Copy link

kennym commented Nov 15, 2019

@nidongara it only happens for us in release mode

@nidongara
Copy link
Author

I tried release mode but it doesn't crash. @kennym Did you guys figure out a work around?

@kennym
Copy link

kennym commented Nov 25, 2019

@nidongara we have not.

@lklepner
Copy link

Also reported in the latest version, 0.61.5
#27363

@gnprice
Copy link
Contributor

gnprice commented Jan 7, 2020

@nidongara Would you try editing the issue description to indicate a current version of React Native, based on the reports in comments? Here's the instructions the bot gave (they're hidden behind a fold):

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

It looks like nobody at Facebook has noticed this issue -- I suspect they completely ignore issues when they have that label attached.

@luatnd
Copy link

luatnd commented Mar 10, 2020

I met the same issue:

Crashed: com.apple.root.user-interactive-qos
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00003b57d32db480

Crashed: com.apple.root.user-interactive-qos
0  Money24H                       0x102ca10e8 facebook::react::Instance::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 61 (Instance.cpp:61)
1  Money24H                       0x102ca149c facebook::react::Instance::loadScriptFromString(std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool) + 1421 (string:1421)
2  Money24H                       0x102c10568 __51-[RCTCxxBridge executeApplicationScript:url:async:]_block_invoke + 1421 (string:1421)
3  Money24H                       0x102c14b30 facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 141168 (RCTCxxUtils.mm:141168)
4  Money24H                       0x102c0a7d0 -[RCTCxxBridge _tryAndHandleError:] + 280 (RCTCxxBridge.mm:280)
5  Money24H                       0x102c10264 -[RCTCxxBridge executeApplicationScript:url:async:] + 1336 (RCTCxxBridge.mm:1336)
6  Money24H                       0x102c10058 -[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 1292 (RCTCxxBridge.mm:1292)
7  Money24H                       0x102c0dd2c -[RCTCxxBridge executeSourceCode:sync:] + 915 (RCTCxxBridge.mm:915)
8  Money24H                       0x102c0b5d8 __21-[RCTCxxBridge start]_block_invoke_2 + 396 (RCTCxxBridge.mm:396)
9  libdispatch.dylib              0x18eaf4a38 _dispatch_call_block_and_release + 24
10 libdispatch.dylib              0x18eaf57d4 _dispatch_client_callout + 16
11 libdispatch.dylib              0x18ead8afc _dispatch_root_queue_drain + 636
12 libdispatch.dylib              0x18ead9248 _dispatch_worker_thread2 + 116
13 libsystem_pthread.dylib        0x18ecd51b4 _pthread_wqthread + 464
14 libsystem_pthread.dylib        0x18ecd7cd4 start_wqthread + 4

react-native info output:

System:
    OS: macOS Mojave 10.14.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 143.97 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node
    Yarn: 1.10.1 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v12.6.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 25, 26, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: ^0.60.3 => 0.60.6 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-pushdy: 0.0.11
    react-native-swift-cli: 2.3.0

@XuNeal
Copy link

XuNeal commented May 11, 2020

same issue +1, And the number has risen dramatically in the last week

@gnprice
Copy link
Contributor

gnprice commented May 20, 2020

At this point it's no longer helpful to add more reports of seeing the issue on RN v0.59. I think it's no longer helpful to report seeing it even on RN v0.61, now that v0.62 is out.

What would be very helpful is a report for v0.62, the latest version. (Or better yet, the v0.63 release candidate!)

If you're looking at this thread because you're seeing this issue, and your app is using v0.62 (or later): please add a comment with details like @luatnd's #26985 (comment) 😄

Until then the developers of React Native will effectively assume the issue was fixed in v0.62, and ignore it to focus on the many other things on their to-do list. That's what, as I read it, the label "Needs: Verify on Latest Version" means.

And if you're reading this in the future, and someone has already reported it on v0.62 and a newer release is out (but this thread doesn't show a fix yet): same thing applies, just increment all the version numbers in this comment.

@iagoSLima
Copy link

iagoSLima commented Jun 8, 2020

I met the same issue:

Crashed: com.apple.root.user-interactive-qos
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00003b57d32db480

Crashed: com.apple.root.user-interactive-qos
0  Money24H                       0x102ca10e8 facebook::react::Instance::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 61 (Instance.cpp:61)
1  Money24H                       0x102ca149c facebook::react::Instance::loadScriptFromString(std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool) + 1421 (string:1421)
2  Money24H                       0x102c10568 __51-[RCTCxxBridge executeApplicationScript:url:async:]_block_invoke + 1421 (string:1421)
3  Money24H                       0x102c14b30 facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 141168 (RCTCxxUtils.mm:141168)
4  Money24H                       0x102c0a7d0 -[RCTCxxBridge _tryAndHandleError:] + 280 (RCTCxxBridge.mm:280)
5  Money24H                       0x102c10264 -[RCTCxxBridge executeApplicationScript:url:async:] + 1336 (RCTCxxBridge.mm:1336)
6  Money24H                       0x102c10058 -[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 1292 (RCTCxxBridge.mm:1292)
7  Money24H                       0x102c0dd2c -[RCTCxxBridge executeSourceCode:sync:] + 915 (RCTCxxBridge.mm:915)
8  Money24H                       0x102c0b5d8 __21-[RCTCxxBridge start]_block_invoke_2 + 396 (RCTCxxBridge.mm:396)
9  libdispatch.dylib              0x18eaf4a38 _dispatch_call_block_and_release + 24
10 libdispatch.dylib              0x18eaf57d4 _dispatch_client_callout + 16
11 libdispatch.dylib              0x18ead8afc _dispatch_root_queue_drain + 636
12 libdispatch.dylib              0x18ead9248 _dispatch_worker_thread2 + 116
13 libsystem_pthread.dylib        0x18ecd51b4 _pthread_wqthread + 464
14 libsystem_pthread.dylib        0x18ecd7cd4 start_wqthread + 4

react-native info output:

System:
    OS: macOS Mojave 10.14.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 143.97 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node
    Yarn: 1.10.1 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v12.6.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 25, 26, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: ^0.60.3 => 0.60.6 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-pushdy: 0.0.11
    react-native-swift-cli: 2.3.0

I'm really having a problem. But my version of react-native is the 0.62.2
react-native info output:

System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
    Memory: 96.43 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.18.0 - ~/.nvm/versions/node/v10.18.0/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v10.18.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 22, 23, 24, 25, 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.2, 30.0.0
      System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_222 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found```

@apklinker
Copy link

I am also having this problem on 62.2

@asafda
Copy link

asafda commented Jul 14, 2020

same here with version 62.2

@dougcoburn
Copy link

For us, this crash didn't happen until the release where we enabled RAM bundling.

@xwartz
Copy link

xwartz commented Jul 31, 2020

@dougcoburn
Hello, how did you reproduce it? And how to prove that enabled RAM bundling setting works.

@mydylan
Copy link

mydylan commented Aug 4, 2020

Unfortunately I am having this issue in 62.2

@SchneiderOr
Copy link

Struggle is real! i can still reproduce it with versions 62.2

@aklinker1
Copy link

I was able to get this resolved by rewriting our AppDelagate.m and AppDelagate.h from scratch.

Used the react native upgrade helper to see what those files looks like for a new project, copied that in, and the went though all our native libs that had modified those files (RNN, firebase, and app auth) to set them back up.

By the time that I finished, there was about a 30 line difference. At some point we did a bad upgrade in the past or their initialization had changed, and it finally started crashing when iOS 13 came out.

@asafda
Copy link

asafda commented Aug 10, 2020

@aklinker1 do you mind sharing your AppDelegate.m before and after?

@aklinker1
Copy link

Sure thing! This is before and after the fixes for RN 60, but this also worked when we did similar re-writes for RN 62. The main thing to notice is how different the RNN and Firebase setups are.

I would also recommend making these changes in XCode, you'll get errors and warnings in real time.

AppDelegate.m Before
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>
#import <Firebase.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"HelloWorld"
                                            initialProperties:nil];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  // Fix occasional white screen on startup in release builds
  UIView* launchScreenView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] objectAtIndex:0];
  launchScreenView.frame = self.window.bounds;
  rootView.loadingView = launchScreenView;

  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end
AppDelegate.m After
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <Firebase.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  if ([FIRApp defaultApp] == nil) {
    [FIRApp configure];
  }
  
  #if DEBUG
  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  #else
  NSURL *jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  #endif
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
  
  return YES;
}

@end
AppDelegate.h Before
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>

@property (nonatomic, strong) UIWindow *window;

@end
AppDelegate.h After
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (nonatomic, strong) UIWindow *window;

@end

@stale
Copy link

stale bot commented Dec 25, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 25, 2020
@gabrielhpugliese
Copy link

I am still on 62.2 and I am wondering if it's fixed on 63+/64 but kinda didn't want to take such big effort and discover it will not work. Could you share your experience, please?

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 10, 2021
@radhakrishnant2s
Copy link

I am using "0.61.5" and this issue exists.

@asymptotik
Copy link

asymptotik commented May 7, 2021

Published a new app and seeing the issue on 0.63.3

System:
    OS: macOS 11.2.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 10.18 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.12.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.6.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /Users/rick/.rvm/gems/ruby-2.6.5/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 26, 27, 28, 29, 30
      Build Tools: 27.0.3, 28.0.3, 29.0.2
      System Images: android-23 | Google APIs Intel x86 Atom_64, android-24 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom
      Android NDK: 21.3.6528147
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_241 - /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/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
Crashed: com.apple.root.user-interactive-qos
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
-[RCTCxxBridge enqueueApplicationScript:url:onComplete:]

Crashed: com.apple.root.user-interactive-qos
0  MyApp                      0x10232d14c -[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 1309 (RCTCxxBridge.mm:1309)
1  MyApp                      0x10232abb0 -[RCTCxxBridge executeSourceCode:sync:] + 918 (RCTCxxBridge.mm:918)
2  MyApp                      0x102328318 __21-[RCTCxxBridge start]_block_invoke_2 + 387 (RCTCxxBridge.mm:387)
3  libdispatch.dylib              0x195efc24c _dispatch_call_block_and_release + 32
4  libdispatch.dylib              0x195efddb0 _dispatch_client_callout + 20
5  libdispatch.dylib              0x195f0ea68 _dispatch_root_queue_drain + 656
6  libdispatch.dylib              0x195f0f120 _dispatch_worker_thread2 + 116
7  libsystem_pthread.dylib        0x1e1db57d8 _pthread_wqthread + 216
8  libsystem_pthread.dylib        0x1e1dbc76c start_wqthread + 8
Device
Model:iPhone 12 Pro Max
Orientation: Portrait
RAM free: 363.25 MB
Disk free: 58.92 GB
Operating System
Version:14.4.2 (18D70)
Orientation: Portrait
Jailbroken:No
Crash
Date:May 7, 2021, 12:28:20 AM
App version:2.0.0 (2011)

@asymptotik
Copy link

I was able to make updates based on the above post from @aklinker1. I've since not seen this crash show up. Our AppDelegate.mm was very similar with a few extra pieces to register for notifications, etc. Seems a bit obvious now as our code and the RNN code was creating a new RCTBridge. The updates have been in the wild for a couple of weeks now, with a much wider distribution and we have not seen this crash.

@djs66256
Copy link

Here's one situation.

When [CxxBridge start], we call [CxxBridge invalidate] immediately.

-[RCTCxxBridge executeApplicationScript:url:async:] is on dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), but self->_reactInstance.reset(); is on JSThread.

I think the reason is reactInstance->loadApplication called when reactInstance->reset.

@bemaverick
Copy link

Any fixes?
I have the same problem on production, but can't reproduce crash on my devices

@xwartz
Copy link

xwartz commented Sep 6, 2022

any update on this?

@rajeshsahaninmg
Copy link

@asymptotik Do you have anyidea for fix those issue
[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 1487 (RCTCxxBridge.mm:1487)
0x6e13ec -[RCTCxxBridge executeSourceCode:sync:] + 1080 (RCTCxxBridge.mm:1080)
0x6dea4c __21-[RCTCxxBridge start]_block_invoke_2 + 508 (RCTCxxBridge.mm:508)

@kelset kelset added Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Author Feedback labels Apr 6, 2023
@github-actions
Copy link

github-actions bot commented Apr 6, 2023

⚠️ Missing Reproducible Example
ℹ️ It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

@github-actions
Copy link

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 30, 2023
@github-actions
Copy link

github-actions bot commented May 7, 2023

This issue was closed because the author hasn't provided the requested feedback after 7 days.

@github-actions
Copy link

github-actions bot commented May 7, 2023

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as completed May 7, 2023
@johnnyrwest
Copy link

Are folks still running into this? Seeing crash reports related to this on 0.71.1

@gnprice
Copy link
Contributor

gnprice commented Jul 28, 2023

This issue should not be closed, because there's no reason to believe it has been fixed.

The thing that's needed in order to make progress on the issue is a way to reproduce it. If anyone discovers a way to reproduce this issue, please post it — that would be a very helpful contribution.

Until there's a repro, it's unlikely anyone will fix the issue. But as long as the bug exists, it's better to have the issue thread remain open. Otherwise the result will just be that it splinters across a bunch of newly-filed issue threads as people continue running into it, and that doesn't do anyone any good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Newer Patch Available Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests