facebook / react-native

A framework for building native applications using React

Home Page:https://reactnative.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0.62 JSC hit 100% cpu in Release, not Debug

fungilation opened this issue · comments

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Before upgrading, my app was on RN 0.61.5. No issue on cpu pegged at 100%.

After upgrade to 0.62.1, on certain number crunching in JS and I can't identify exactly in what yet (reason below). I'm getting 100% cpu pegged and app completely stalled from doing anything else, though UI is not frozen. This is due to JSC is completely blocked. This is when app is built in release mode, and so JSC is run on real device (iPhone X)
image

If I rebuilt app in Debug mode, running on same real device, and doing same UX on app. No more issue as JS processing is run in Chrome's V8 instead:
image

React Native version:

System:
    OS: macOS 10.15.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 2.00 GB / 40.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.12.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/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:
      Android NDK: 21.0.6113669
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  Languages:
    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.1 => 0.62.1
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

I can't list repro steps as I'm not sure what in my JS code is triggering the 100% cpu in JSC, that doesn't occur in Debug mode V8. But there's clearly something changed from RN 0.61 -> 0.62 upgrade that changed it.

And since I can't debug while the JSC cpu pegged occurs only in Release mode, this makes this a Heisenbug. How do I debug when app in debug mode doesn't manifest the same issue that's in release?

Expected Results

JSC not stalled in Release mode on device

Isolated cause of JSC CPU pegging to be somewhere in react-native-cached-image in my app. I'm deprecating its use to just use RN's own Image.

commented

Hi, I'm facing the same issue, using the Image native component didn't solve the problem. Actually, even I'm trying with real device Iphone X and emulator, same result... But. when I run the project with iPhone 11 Pro max emulator OS 13.3, the problem is not there, the CPU is at 0%. I've searched everywhere and this is the only topic that seems to be the same issue. I need some help here.

Hi @fungilation and thank you for your fork of react-native-cached-image! 🎉

I'm upgrading my app to RN 0.62 and I just saw that react-native-cached-image as been deprecated in favor of RN's own image but I was wondering if you managed to make RN's Images cache work on Android as the documentation says that Cache Control is only for iOS...

Thanks for your response! 😊