callstack / repack

A Webpack-based toolkit to build your React Native application with full support of Webpack ecosystem.
https://re-pack.dev
MIT License
1.47k stars 106 forks source link

react-native-svg crashing in release in TesterApp #115

Closed oblador closed 8 months ago

oblador commented 3 years ago

Description

I've had some issues upgrading from 2.0.0 to 2.40 with android release mode specifically and when trying to reproduce it in the tester app I found similar issues, namely the following:

HermesVM: JSI rethrowing JS exception: Cannot read property 'descriptors' of undefined
HermesVM: 
HermesVM: TypeError: Cannot read property 'descriptors' of undefined
HermesVM:     at 72147 (address at index.android.bundle:1:574632)
HermesVM:     at call (native)
HermesVM:     at __webpack_require__ (address at index.android.bundle:1:8502)
HermesVM:     at s (address at index.android.bundle:1:714061)
HermesVM:     at 29896 (address at index.android.bundle:1:617628)
HermesVM:     at call (native)
HermesVM:     at __webpack_require__ (address at index.android.bundle:1:8502)
HermesVM:     at s (address at index.android.bundle:1:714061)
HermesVM:     at 59162 (address at index.android.bundle:1:620839)
HermesVM:     at call (native)
HermesVM:     at __webpack_require__ (address at index.android.bundle:1:8502)
HermesVM:     at s (address at index.android.bundle:1:714061)
HermesVM:     at 66232 (address at index.android.bundle:1:590168)
HermesVM:     at call (native)
HermesVM:     at __webpack_require__ (address at index.android.bundle:1:8502)
HermesVM:     at s (address at index.android.bundle:1:714061)
HermesVM:     at 18918 (address at index.android.bundle:1:33132)
HermesVM:     at call (native)
HermesVM:     at __webpack_requi
AndroidRuntime: FATAL EXCEPTION: mqt_js
AndroidRuntime: Process: com.testerapp, PID: 4878
AndroidRuntime: com.facebook.jni.UnknownCppException: Unknown
AndroidRuntime:  at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
AndroidRuntime:  at android.os.Handler.handleCallback(Handler.java:873)
AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:99)
AndroidRuntime:  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
AndroidRuntime:  at android.os.Looper.loop(Looper.java:193)
AndroidRuntime:  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
AndroidRuntime:  at java.lang.Thread.run(Thread.java:764)

Through git bisect I tracked it down to being caused by PR #81.

Reproducible Demo

cd packages/TesterApp/android
./gradlew clean
./gradlew assembleRelease
adb install ./app/build/outputs/apk/release/app-release.apk
oblador commented 3 years ago

For me at least it works if I run #106 instead of main branch (also works after rebase).

zamotany commented 3 years ago

After investigating the issue, the crash is caused by react-native-svg itself in release mode. Debug works just fine. Adding missing proguard rule and marking react-native-svg as nohoist doesn't solve the issue. What's more interesting is that with Metro, react-native-svg doesn't crash but also doesn't render anything.

zamotany commented 3 years ago

react-native-svg throws the same error with RN 0.66 (tested on #106).

jbinda commented 1 year ago

Hey @zamotany and @oblador

We did some investigation with @lukewalczak and we've noticed that disabling hermes prevents app crash in production.

We also get report that it occurs in TesterApp based on V3 of Re.Pack and RN 0.68 🤔 - however weren't able to reproduce it.

Any ideas what can cause a conflict with enabling hermes ?

shravansrinivas commented 12 months ago

Hey @zamotany and @oblador

We did some investigation with @lukewalczak and we've noticed that disabling hermes prevents app crash in production.

We also get report that it occurs in TesterApp based on V3 of Re.Pack and RN 0.68 🤔 - however weren't able to reproduce it.

Any ideas what can cause a conflict with enabling hermes ?

I observed exactly the same behaviour when I disabled hermes with react-native version 0.72. Curious to understand what is hermes' implication here 🤔

github-actions[bot] commented 8 months ago

This issue has been marked as stale because it has been inactive for 30 days. Please update this issue or it will be automatically closed in 14 days.

github-actions[bot] commented 8 months ago

This issue has been automatically closed because it has been inactive for more than 14 days. Please reopen if you want to add more context.

hosseinmd commented 2 months ago

Please, Open this issue, it is not resolved.

jbroma commented 2 months ago

@hosseinmd please provide a minimal reproduction repository if you are facing this issue, we have react-native-svg in our tester-app and it's not crashing in release mode

hosseinmd commented 2 months ago

i found the root cause, that was because of import { SvgCssUri } from 'react-native-svg/css';