Skip to content

EXC_BAD_ACCESS Fatal Unhandled CEST > XTUM > KERN_INVALID_ADDRESS at 0x1c20. #150

@holakmateusz

Description

@holakmateusz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions