EXC_BAD_ACCESS Fatal Unhandled CEST > XTUM > KERN_INVALID_ADDRESS at 0x1c20.
Title: EXC_BAD_ACCESS Fatal Unhandled CEST > XTUM > KERN_INVALID_ADDRESS at 0x1c20 Description:
I'm encountering a fatal crash in my app using the pose detection frame processor, where the error is consistently related to an EXC_BAD_ACCESS exception. The error message points to an invalid memory address (KERN_INVALID_ADDRESS) at 0x1c20.
The crash occurs when accessing or releasing a pose detector through detectorMap. I suspect the issue is related to race conditions caused by concurrent access to shared resources in the native PoseDetectionModule, particularly the detectorMap which stores pose detection instances. Steps to Reproduce:
Create a pose detector using the PoseDetectionModule.createDetector() function.
Use useFrameProcessor to process frames with real-time pose detection.
Release the detector using PoseDetectionModule.releaseDetector() after a few frames.
Occasionally, the app crashes during or after detector release with the EXC_BAD_ACCESS error.
The crash seems to happen when multiple threads are accessing the detector (from the camera frame processor and JavaScript thread) while the native code attempts to release or access the detector from the detectorMap. Expected Behavior:
Pose detection should run without crashes.
Detectors should be safely created, accessed, and released without causing memory access issues or race conditions.
Observed Behavior:
The app crashes intermittently with the following error:
EXC_BAD_ACCESS Fatal Unhandled CEST > XTUM > KERN_INVALID_ADDRESS at 0x1c20.
The crash consistently occurs when accessing or releasing a detector from the detectorMap.
Environment:
React Native version: [0.73.9]
react-native-vision-camera: [4.5.1]
react-native-reanimated: [3.12.1]
react-native-worklets-core: [1.3.3]
expo: [~50.0.17]
@shopify/react-native-skia: [1.3.13]
Library version: 0.5.1
OS: iOS 17.6.1 (reproducible on multiple versions)
Device: iPhone 14 Pro (reproducible on multiple devices)
Xcode: 15.x
Hi, did you solve the problem?
@JangwonLim Yes, I did, but it was workaround for those specific environment that I have mentioned in the ticket, but the issue shouldn't occurs in new architecture. Why do you ask?
@holakmateusz How did you apply the fix here? I'm having the same issue, and it happens when I have background apps running on my iPhone 14.
I would really appreciate if you could tell me on how to approach to this and apply the fix on my side. Thanks a lot!
@mSenad Could you tell me which version of RN do you use?
@mSenad Could you tell me which version of RN do you use?
Unfortunately, "react-native": "0.74.2", - hope there's some kind of workaround or fix for it
0.76 with new arch is your solution, anything else is a workaround which I really did in my case, but definitely go ahead and upgrade RN to at least 0.76.