TestFlight/Production App Crashes immediately due to Reanimated
Description
Description
I'm experiencing a consistent crash in my React Native app running on TestFlight. The crash occurs immediately after app launch during the initialization phase, specifically related to Reanimated and Hermes runtime. The crash appears to be related to a race condition during initialization where multiple threads are trying to access the Reanimated runtime simultaneously.
The app works perfectly in development environment and build. Its only when I build production and submit to Testflight do I run into this crashing behavior
The crash manifests in Thread 9 (Hermes thread) during HadesGC operations. This consistently happens on app launch in the production build.
Initially, this issue occurred with Expo SDK 51 and react-native-reanimated 3.10. I attempted to resolve it by upgrading to Expo SDK 52 and react-native-reanimated 3.16.1, but the crash persists with the same pattern.
Crash Log Details
Key parts of the stack trace:
14 Mindara worklets::ReanimatedRuntime::make(...) + 112 (ReanimatedRuntime.cpp:31)
15 Mindara worklets::makeRuntime(...) + 20 (WorkletRuntime.cpp:46)
16 Mindara worklets::WorkletRuntime::WorkletRuntime(...)Thread 9 also shows:
0 hermes 0x00000001049a2c40 hermes::vm::HadesGC::HeapSegment::setCellHead(hermes::vm::GCCell const*, unsigned long) + 64
1 hermes 0x00000001049a6c0c hermes::vm::HadesGC::OldGen::search(unsigned int) + 376
[...]Full crash log can be provided if needed.
Steps to Reproduce
- Install app from TestFlight
- Launch app
- App crashes immediately after launch (consistently reproducible)
Environment
Current Environment:
- Expo SDK: 52.0.0
- Architecture: Old Architecture
- Build type: Release (TestFlight)
- Device: iPhone 13 Pro
- OS Version: iOS 18.1.1
Previously tested on:
- Expo SDK: 51
- Reanimated: 3.10
- (Same crash pattern observed)
Additional Context
The app is using several native modules that need to initialize on startup:
- react-native-reanimated
- @superwall/react-native-superwall
- react-native-track-player
These all need to initialize properly with the JS runtime during app launch.
Code
// Current initialization approach in App.tsx
useEffect(() => {
async function prepare() {
try {
await waitForReanimatedInit();
console.log('✅ Reanimated initialized');
const apiKey = Platform.OS === "ios"
? "pk_xxx"
: "pk_xxx";
await Superwall.configure(apiKey);
console.log('✅ Superwall configured');
await setupTrackPlayer();
console.log('✅ Track player initialized');
} catch (e) {
console.warn('❌ Error during app initialization:', e);
Sentry.captureException(e);
}
}
prepare();
}, []);Attempted Solutions
- Upgraded from Expo SDK 51 to 52
- Upgraded react-native-reanimated from 3.10 to 3.16.1
- Verified all dependencies are up to date
- Confirmed crash happens consistently in production but not in development
- Added error handling and logging
- Implemented sequential initialization
Steps to reproduce
- Install app from TestFlight
- Launch app
- App crashes immediately after launch (consistently reproducible)
Snack or a link to a repository
happens immediately on launch so hard to reproduce
Reanimated version
3.16.1
React Native version
0.76.5
Platforms
iOS
JavaScript runtime
Hermes
Workflow
Expo Dev Client
Architecture
Paper (Old Architecture)
Build type
None
Device
Real device
Device model
No response
Acknowledgements
Yes
Source: software-mansion/react-native-reanimated