Dynamsoft / capture-vision-react-native-samples

Dynamsoft Capture Vision React-Native SDK Samples
https://www.dynamsoft.com/capture-vision/docs/introduction/
Other
15 stars 7 forks source link

App frozen #40

Closed tousif-p99soft closed 9 months ago

tousif-p99soft commented 1 year ago

The app getting freezing on unmounting, any solution?

Dynamsoft-Henry commented 1 year ago

Hi @tousif-p99soft

Would you like to share your usage scenario by sending us a sample code that can re-produce your freezing issue?

tousif-p99soft commented 1 year ago

@Dynamsoft-Henry I have one component with DCVCameraView and when navigating from this component it takes time to hide and freeze the app, when removing DCVCameraView then it is working fine.

It is always happened on simulator but on real device sometimes only

badbeoti commented 1 year ago

@Dynamsoft-Henry

Same issue here. I don't know exactly. But sometimes app gonna be freeze when use DCVCameraView. In my case, It only occurs on real devices.

Dynamsoft-Henry commented 1 year ago

Hi @tousif-p99soft @badbeoti

Are you using iOS or Android? What's your device model and the simulator model? It helps us debug if you can share your device model or a sample code.

I don't know how you describe "freeze". The open / close of the camera might take some time. Is the freeze permanent or just last for a few seconds?

tousif-p99soft commented 1 year ago

I am using iPhone 14 Pro simulator

app freezing for approx 20 sec


From: Dynamsoft-Henry @.> Sent: Thursday, May 25, 2023 3:16:13 PM To: Dynamsoft/capture-vision-react-native @.> Cc: Tousif @.>; Mention @.> Subject: Re: [Dynamsoft/capture-vision-react-native] App frozen (Issue #40)

Hi @tousif-p99softhttps://github.com/tousif-p99soft @badbeotihttps://github.com/badbeoti

Are you using iOS or Android? What's your device model and the simulator model? It helps us debug if you can share your device model or a sample code.

I don't know how you describe "freeze". The open / close of the camera might take some time. Is the freeze permanent or just last for a few seconds?

— Reply to this email directly, view it on GitHubhttps://github.com/Dynamsoft/capture-vision-react-native/issues/40#issuecomment-1562607536, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4TTLCKKXYXQPKXEWMP6IZLXH4S6LANCNFSM6AAAAAAYNHFVPE. You are receiving this because you were mentioned.Message ID: @.***>

badbeoti commented 1 year ago

Hi @tousif-p99soft @badbeoti

Are you using iOS or Android? What's your device model and the simulator model? It helps us debug if you can share your device model or a sample code.

I don't know how you describe "freeze". The open / close of the camera might take some time. Is the freeze permanent or just last for a few seconds?

I'm using both though but only iOS has error now. Also I mean 'freeze' is seems like totally pause and then turn off. In my opinion, We can found this things when using 'react-native-navigation' with 'DCVCameraView'

Dynamsoft-Henry commented 1 year ago

@tousif-p99soft @badbeoti We made some attempts on the 'freeze' issue.

What we can re-produce is:

  1. Open the camera to scan.
  2. Close the camera.
  3. Try re-open the camera.

The freeze occurs between 2-3. It last for about 10 seconds on our device (simulator only). Is the issue the same as yours?

This issue is caused by a system method "AVCaptureSession stopRunning". It is a sync method that might block the thread on simulators. Since our SDK is not designed for scanning on the simulator, we prefer to wait for iOS to solve this issue instead of try fixing it on SDK.

We can't re-produce it on real devices. Could you share a screen recording of the issue to describe how you produce it on a real device?

badbeoti commented 1 year ago

@tousif-p99soft @badbeoti We made some attempts on the 'freeze' issue.

What we can re-produce is:

  1. Open the camera to scan.
  2. Close the camera.
  3. Try re-open the camera.

The freeze occurs between 2-3. It last for about 10 seconds on our device (simulator only). Is the issue the same as yours?

This issue is caused by a system method "AVCaptureSession stopRunning". It is a sync method that might block the thread on simulators. Since our SDK is not designed for scanning on the simulator, we prefer to wait for iOS to solve this issue instead of try fixing it on SDK.

We can't re-produce it on real devices. Could you share a screen recording of the issue to describe how you produce it on a real device?

Unfortunately, in my case, I'm only talking about errors made on real devices. I will upload a related video when I go to work next time.

badbeoti commented 1 year ago

@Dynamsoft-Henry I'm sorry. We don't have any video about this error now. We will proceed with the test and collect related videos.

Dynamsoft-Henry commented 1 year ago

@badbeoti No matter. Thanks.

tousif-p99soft commented 11 months ago

@Dynamsoft-Henry One more observation, if the scanner opens and closes multiple times then suddenly it gets frozen and crashes.

Stack traces which are recorded on Sentry

libsystem_kernel 0x1f8f93f3c psynch_mutexwait libsystem_pthread 0x20851461c _pthread_mutex_firstfit_lock_wait libsystem_pthread 0x20850b300 _pthread_mutex_firstfit_lock_slow$VARIANT$armv81 AVFCapture 0x1d67ea6a4 -[AVCaptureSession _buildAndRunGraph:] AVFCapture 0x1d675891c -[AVCaptureSession _commitConfiguration] AVFCapture 0x1d6798300 -[AVCaptureVideoPreviewLayer setSession:] AVFCapture 0x1d6789234 -[AVCaptureSession _removeAllPreviewLayers] AVFCapture 0x1d6788d7c -[AVCaptureSession _addVideoPreviewLayer:exceptionReason:] AVFCapture 0x1d6798338 -[AVCaptureVideoPreviewLayer setSession:] DynamsoftCameraEnhancer0x1047ee170 CoreFoundation 0x1be504854 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER CoreFoundation 0x1be5a1128 _CFXRegistrationPost_block_invoke CoreFoundation 0x1be585910 _CFXRegistrationPost CoreFoundation 0x1be517f68 _CFXNotificationPost Foundation 0x1b88b4210 -[NSNotificationCenter postNotificationName:object:userInfo:] DynamsoftCameraEnhancer0x1047ded74 PickingApp 0x10101118c -[DYSCameraView init] (DYSCameraView.m:28) PickingApp 0x101012284 -[DYSCameraViewManager view] (DYSCameraViewManager.m:30) PickingApp 0x10119d4d4 -[RCTComponentData createViewWithTag:rootTag:] (RCTComponentData.m:81) PickingApp 0x10126c4c0 50-[RCTUIManager createView:viewName:rootTag:props:]_block_invoke (RCTUIManager.m:1007) PickingApp 0x101275b08 RCTExecuteOnMainQueue_block_invoke (RCTUtils.m:265) libdispatch 0x1c527a7a4 _dispatch_call_block_and_release libdispatch 0x1c527b77c _dispatch_client_callout libdispatch 0x1c525ce0c _dispatch_main_queue_drain libdispatch 0x1c525ca84 _dispatch_main_queue_callback_4CF$VARIANT$armv81 CoreFoundation 0x1be561a28 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE CoreFoundation 0x1be5456c4 __CFRunLoopRun CoreFoundation 0x1be549d9c CFRunLoopRunSpecific GraphicsServices 0x1f58b8994 GSEventRunModal UIKitCore 0x1c07db808 -[UIApplication _run] UIKitCore 0x1c07db480 UIApplicationMain PickingApp 0x100bfdebc main (main.m:8)

badbeoti commented 11 months ago

@tousif-p99soft Check this issue. link

tousif-p99soft commented 11 months ago

@badbeoti Thanks, buddy!

I think it is working :)

Now testing more!