mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.39k stars 1.08k forks source link

🐛 [iOS] `NSRangeException` crash ending recording session #3209

Open jkaufman opened 2 weeks ago

jkaufman commented 2 weeks ago

What's happening?

Caught this error using Crashlytics. The trace may be sufficient to debug. I do not have ADB logs or a minimal reproducible result. Even if the ticket isn't actionable and is closed, I want to record it in case others encounter the same issue.


Fatal Exception: NSRangeException
0  CoreFoundation                 0x83f20 __exceptionPreprocess
1  libobjc.A.dylib                0x172b8 objc_exception_throw
2  CoreFoundation                 0x25298 -[__NSArrayI objectAtIndex:]
3  AVFCore                        0xcd774 -[AVFigAssetWriterAudioTrack _flushPendingSampleBuffersReturningError:]
4  AVFCore                        0xb8de4 -[AVAssetWriterWritingHelper endSessionAtSourceTime:]
5  AVFCore                        0xb4bfc -[AVAssetWriter endSessionAtSourceTime:]
6  app                       0x64ad0c RecordingSession.finish() + 305 (RecordingSession.swift:305)
7  app                       0x6495e4 RecordingSession.append(buffer:ofType:) + 252 (RecordingSession.swift:252)
8  app                       0x63087c CameraSession.onVideoFrame(sampleBuffer:orientation:) + 283 (CameraSession.swift:283)
9  app                       0x630d70 @objc CameraSession.captureOutput(_:didOutput:from:) (<compiler-generated>)
10 AVFCapture                     0x27fac -[AVCaptureVideoDataOutput _processSampleBuffer:]
11 AVFCapture                     0x4bd48 __47-[AVCaptureVideoDataOutput _updateRemoteQueue:]_block_invoke
12 CMCapture                      0xce3a0 __FigRemoteOperationReceiverCreateMessageReceiver_block_invoke
13 CMCapture                      0xce010 __rqReceiverSetSource_block_invoke
14 libdispatch.dylib              0x3dd4 _dispatch_client_callout
15 libdispatch.dylib              0x72d8 _dispatch_continuation_pop
16 libdispatch.dylib              0x1b1c8 _dispatch_source_latch_and_call
17 libdispatch.dylib              0x19d8c _dispatch_source_invoke
18 libdispatch.dylib              0xb284 _dispatch_lane_serial_drain
19 libdispatch.dylib              0xbf30 _dispatch_lane_invoke
20 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh
21 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread
22 libsystem_pthread.dylib        0x4934 _pthread_wqthread
23 libsystem_pthread.dylib        0x10cc start_wqthread

Full crash log here: com.app.name_issue_d60b3ee3b38b5bce78523d1a030ee61b_crash_session_fd66e2eedf3a4f1e9e08761f9dcba50c_DNE_0_v2_stacktrace.txt

Reproduceable Code

<Camera
                style={…}
                ref={…}
                device={…}
                isActive={…}
                format={…}
                fps={…}
                photo={false}
                video={true}
                audio={true}
                torch={…}
                outputOrientation={'device'}
              />

Relevant log output

No log output available to share.
Crash detected in production.
Will share if able to reproduce locally.

Camera Device

Available details:

{
    "duration": 66,
    "format": {
        "minISO": 34,
        "photoHeight": 1188,
        "fieldOfView": 106.7479019165039,
        "maxFps": 60,
        "videoHeight": 1080,
        "autoFocusSystem": "phase-detection",
        "supportsVideoHdr": false,
        "videoWidth": 1920,
        "minFps": 1,
        "supportsPhotoHdr": false,
        "photoWidth": 2112,
        "supportsDepthCapture": false,
        "maxISO": 3264,
        "videoStabilizationModes": [
            "auto",
            "cinematic",
            "off",
            "standard",
            "cinematic-extended"
        ]
    },
    "deviceName": "Back Triple Camera"
}

Device

iPhone 13 Pro (iOS 17.6.1)

VisionCamera Version

4.4.3

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

maintenance-hans[bot] commented 2 weeks ago

Guten Tag, Hans here! 🍻

Thank you for reporting zis issue. It looks like you've encountered a NSRangeException crash, but unfortunately, without ADB logs or a reproducible scenario, it makes it quite difficult to diagnose.

Please try to reproduce zis issue and gather relevant logs from Xcode while running your application. You can find ze logs in ze Xcode console. If you can provide those logs, it will help mrousavy a lot in investigating zis problem further.

In ze meantime, if you appreciate ze work done on zis project, consider sponsoring mrousavy here. It really helps!

Looking forward to mehr information!

Note: If you think I made a mistake, please ping @mrousavy to take a look.