Description
Bug Description
We are unable to open our full app in development, which runs a single bundle with over 40,000 modules. In production we are using Re.Pack which enables code-splitting and does not run into this problem.
In this PR the default JS register count was doubled - #923. Sadly we are hitting the same error again.
Note that the error is not reproducible using JSC in our reproduction repo (see below).
- I have run
gradle clean
and confirmed this bug does not occur with JSC - The issue is reproducible with the latest version of React Native.
Environment
Hermes git revision (if applicable): unknown, tied to RN versions below
React Native version: 0.72.12 (our app), 0.74.2 (reproduction app)
OS: OSX
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): unknown, this occurs in the iOS simulator and android emulator
Steps To Reproduce
I've been able to mostly* reproduce it in this repo - https://github.com/mikeduminy/rn-reproducer.
*
The error we're experiencing in our app is"RangeError: Maximum callstack size exceeded - no stack"
whereas the error in this reproduction repo is simply"RangeError: Maximum callstack size exceeded"
so I'm not 100% certain it has the same cause.
Steps to reproduce:
- Clone above repo and install dependencies
- Generate 50,000 modules to simulate a large app (note: no lazy imports)
- Run the app on iOS simulator and Android emulator
- Observe the red screen (note, you may need to close and re-open the app to see this)
The Expected Behavior
A unhandled JS Exception should be thrown but it would not be a call stack size exceeded error.
In order to test if the callstack resulted from executing the entrypoint module of the bundle (the last few lines of the bundle) I added a forced error just before that.
serializer: {
getRunModuleStatement: moduleId =>
// If we see this error, it means the module was fully parsed
// If we see another error, it means the problem occurred during the bundle parsing
`throw new Error("before module execution: ${JSON.stringify(
moduleId,
)}"); __r(${JSON.stringify(moduleId)});`,
},
If you see this error then hermes has successfully executed the bundle. If you see the max call stack error then this error was never even reached and that is the problem we are facing in our app - the bundle is not fully executed / loaded.