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

App Crash on Reload with expo reloadAppAsync #2834

Open
pvturchik opened this issue Dec 23, 2024 · 5 comments
Open

App Crash on Reload with expo reloadAppAsync #2834

pvturchik opened this issue Dec 23, 2024 · 5 comments

Comments

@pvturchik
Copy link

pvturchik commented Dec 23, 2024

Description
I used a basic example from the documentation to draw a line using the Points component. The app crashes upon attempting to reload using the reloadAppAsync() function from expo. I have not tested other examples. Note that the application may not crash on the first attempt; sometimes, it requires multiple reloads to reproduce the issue. The crash occurs both in Expo Go and in the release build (tested on iOS)

In my real project, where I render many elements using the skia library, the crash happens consistently on every reload attempt.

In the video, you can see the app flickering — this happens when I press the "Reload app" text. On one of the reloads, the app crashes.

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-12-23.at.19.16.48.mp4

Steps to reproduce

  1. Create a new Expo project - npx create-expo-app@latest (my version is 52.0.20)
  2. Install the @shopify/react-native-skia dependency - npx expo install @shopify/react-native-skia (expo installs 1.5.0 version in my project)
  3. Use the following code in your component
import { reloadAppAsync } from 'expo';
import { Pressable, Text, View } from "react-native";
import { Canvas, Points, vec } from "@shopify/react-native-skia";

const points = [
  vec(128, 0),
  vec(168, 80),
  vec(256, 93),
  vec(192, 155),
  vec(207, 244),
  vec(128, 202),
  vec(49, 244),
  vec(64, 155),
  vec(0, 93),
  vec(88, 80),
  vec(128, 0),
];

export default function Chart() {
  function reload() {
    reloadAppAsync();
  }

  return (
    <View style={{ flex: 1, backgroundColor: '#D0D0D0' }}>
      <Canvas style={{ height: 500 }}>
        <Points
          points={points}
          mode="polygon"
          color="lightblue"
          style="stroke"
          strokeWidth={4}
        />
      </Canvas>
      <Pressable onPress={reload}>
        <Text style={{ fontSize: 24 }}>
          Reload app
        </Text>
      </Pressable>
    </View>
  );
}
@pvturchik
Copy link
Author

@wcandillon Could you help me figure out the problem?

@wcandillon
Copy link
Contributor

yes I could help with this issue. I don't have a setup with expo at moment if you could share an expo project with me where I could reproduce the issue, that would help a lot. I do suspect that the issue as been fixed in 1.10 but I would need to reproduce the issue first to confirm it.

@Hikkikomori72
Copy link

https://github.com/Hikkikomori72/reloadAppAsyncTest

  1. install packages with yarn install
  2. then yarn start
  3. for testing scan qr code in console

@wcandillon the error is repeated when testing on a real device, no problem was detected on the emulator

@wcandillon
Copy link
Contributor

@Hikkikomori72 Thank you for providing a reproduction. Unfortunately I wasn't able to reproduce it. I do believe that v1.10.1 will fix hot reload crashes. This is what I wanted to test however I wasn't able to reproduce the original crash.
In my case I had to install the dev-client, instead of running expo go, could that be why I couldn't reproduce the issue?

@juanmigdr
Copy link

Hey, I am experiencing the exact same issue. And expo-doctor does not recommend versions later than 1.5.0

I have done some investigation and debugging with android tools and this is the error thrown which points to the react-native-skia library (see bottom line of the error log)

2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A  Cmdline: host.exp.exponent
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A  pid: 17047, tid: 17054, name: FinalizerDaemon  >>> host.exp.exponent <<<
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #00 pc 0000000000285940  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (std::__ndk1::__tree<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, facebook::jsi::Function>, std::__ndk1::__map_value_compare<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, facebook::jsi::Function>, std::__ndk1::less<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, facebook::jsi::Function>>>::destroy(std::__ndk1::__tree_node<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, facebook::jsi::Function>, void*>*)+56) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #01 pc 00000000002841f8  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNJsi::RuntimeAwareCache<std::__ndk1::map<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, facebook::jsi::Function, std::__ndk1::less<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, std::__ndk1::allocator<std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const, facebook::jsi::Function>>>>::~RuntimeAwareCache()+72) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #02 pc 000000000028411c  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNJsi::JsiHostObject::~JsiHostObject()+40) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #03 pc 000000000030429c  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNSkia::JsiDomNode::invalidate()+544) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #04 pc 00000000003028ac  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNSkia::JsiDomRenderNode::dispose(bool)+52) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #05 pc 0000000000304240  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNSkia::JsiDomNode::invalidate()+452) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #06 pc 00000000003028ac  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNSkia::JsiDomRenderNode::dispose(bool)+52) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #07 pc 0000000000364dbc  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNSkia::RNSkDomRenderer::~RNSkDomRenderer()+52) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #08 pc 00000000002776ec  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNSkia::RNSkView::~RNSkView()+92) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #09 pc 0000000000276f40  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!librnskia.so (offset 0x2554000) (RNSkia::JniSkiaDomView::~JniSkiaDomView()+120) (BuildId: 69d452d376fd34cbaf09e66c0463f1559c20f136)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #10 pc 00000000000215c8  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/split_config.arm64_v8a.apk!libfbjni.so (offset 0x16c8000) (BuildId: a22242831a7971267de570e06121acb588ce64cd)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #12 pc 0000000000dbb578  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/oat/arm64/base.odex (com.facebook.jni.HybridData.resetNative+72)
2025-01-15 20:56:35.635 17546-17546 DEBUG                   pid-17546                            A        #14 pc 000000000039d7ca  /data/app/~~lk40WOIu4ZKasxWt3bU7MQ==/host.exp.exponent-HV5sgCRrXWG1u1zJGZZ33A==/base.apk (com.shopify.reactnative.skia.SkiaDomView.finalize+10)

Furthermore, updating the library to the latest version does not work since it is not supported by expo (Run expo-doctor and see it yourself) and even if you upgrade it, you will find a ton of errors straight away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants