juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
817 stars 476 forks source link

Crashing randomly in IOS #883

Closed arnabonetraker closed 8 months ago

arnabonetraker commented 9 months ago

I have been facing unexpected crashes randomly in IOS. Crash log

Thread 33 Crashed:
0   libsystem_kernel.dylib          0x00000001ece4501c __pthread_kill + 8 (:-1)
1   libsystem_pthread.dylib         0x000000020f38d680 pthread_kill + 268 (pthread.c:1681)
2   libsystem_c.dylib               0x00000001ad9a5b90 abort + 180 (abort.c:118)
3   Runner                          0x00000001008ec5e0 MLKITx_absl::log_internal::LogMessage::FailWithoutStackTrace() + 20
4   Runner                          0x00000001008ecae0 MLKITx_absl::log_internal::LogMessage::Die() + 36
5   Runner                          0x00000001008ec858 MLKITx_absl::log_internal::LogMessage::SendToLog() + 128
6   Runner                          0x00000001008ec16c MLKITx_absl::log_internal::LogMessage::Flush() + 316
7   Runner                          0x00000001008ecc20 MLKITx_absl::log_internal::LogMessageFatal::~LogMessageFatal() + 20
8   Runner                          0x00000001008ecc48 MLKITx_absl::log_internal::LogMessageFatal::~LogMessageFatal() + 12
9   Runner                          0x00000001000806b4 barhopper::deep_learning::OnedDecoderClient::AutoRegress(barhopper::RecognitionOptions const&, barhopper::deep_learning::OnedDecoderResult*) + 3892
10  Runner                          0x0000000100080d74 barhopper::deep_learning::OnedDecoderClient::Decode(unsigned char const*, barhopper::RecognitionOptions const&, barhopper::deep_learning::OnedDecoderResult*) + 232
11  Runner                          0x00000001000752a0 barhopper::deep_learning::BarhopperV3::Recognize(barhopper::Luminance const&, barhopper::RecognitionOptions const&, std::__1::vector<barhopper::Barcode, std::__1::allocator<barhopper::Barcode> >*) + 1092
12  Runner                          0x0000000100075cec barhopper::deep_learning::BarhopperV3::Recognize(barhopper::Luminance const&, barhopper::RecognitionOptions const&, photos_vision_barhopper::BarhopperResponse*) + 92
13  Runner                          0x0000000100075eb8 barhopper::deep_learning::BarhopperV3::Recognize(int, int, unsigned char const*, barhopper::RecognitionOptions const&, photos_vision_barhopper::BarhopperResponse*) + 80
14  Runner                          0x0000000100071a54 -[MLKVisionBarhopperV3Engine barcodesInImageBufferData:colorModel:width:height:withOptions:error:] + 160
15  Runner                          0x0000000100071940 -[MLKVisionBarhopperV3Engine barcodesInImage:withOptions:error:] + 160
16  Runner                          0x00000001000715f0 -[MLKVisionBarhopperV3Engine barcodesInVisionImage:withOptions:error:] + 124
17  Runner                          0x000000010007089c -[MLKBarcodeScanner barcodesInImage:beginTime:error:] + 116
18  Runner                          0x00000001000702b0 __51-[MLKBarcodeScanner processVisionImage:completion:]_block_invoke + 156
19  libdispatch.dylib               0x00000001ad8eb6a8 _dispatch_call_block_and_release + 32 (init.c:1530)
20  libdispatch.dylib               0x00000001ad8ed300 _dispatch_client_callout + 20 (object.m:561)
21  libdispatch.dylib               0x00000001ad8f4894 _dispatch_lane_serial_drain + 748 (queue.c:3885)
22  libdispatch.dylib               0x00000001ad8f53c4 _dispatch_lane_invoke + 380 (queue.c:3976)
23  libdispatch.dylib               0x00000001ad900004 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6913)
24  libdispatch.dylib               0x00000001ad8ff878 _dispatch_workloop_worker_thread + 404 (queue.c:6507)
25  libsystem_pthread.dylib         0x000000020f389964 _pthread_wqthread + 288 (pthread.c:2629)
26  libsystem_pthread.dylib         0x000000020f389a04 start_wqthread + 8 (:-1)

Flutter Doctor -

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1 23B74 darwin-x64, locale
    en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] Connected device (2 available)
[✓] Network resources
egops commented 9 months ago

I am experiencing the same issue as well. on my IOS12 device, without calling any scanner function, it crashes

Runner`MLKITx_BuildData::BaselineChangelistAsInt:
    0x1011e8540 <+0>:  adrp   x8, 772
    0x1011e8544 <+4>:  ldr    x8, [x8, #0x2d8]
->  0x1011e8548 <+8>:  ldr    x8, [x8]
    0x1011e854c <+12>: cmp    x8, #0x0
    0x1011e8550 <+16>: csinv  x0, x8, xzr, gt
    0x1011e8554 <+20>: ret    

Thread 23: EXC_BAD_ACCESS (code=1, address=0x904000)

egops commented 9 months ago

https://github.com/googlesamples/mlkit/issues/737#issuecomment-1752741598

egops commented 9 months ago

Can the developers of this project help take a look at how to implement the solution I provided in this plugin?

navaronbracke commented 9 months ago

I can have a look to see if switching on that linker flag fixes it for now.

egops commented 9 months ago

I can have a look to see if switching on that linker flag fixes it for now.

any progress?

egops commented 8 months ago

After I update xcode to version 15.1, it solved

navaronbracke commented 8 months ago

@arnabonetraker As stated above, could you try switching to XCode 15.1 ?

arnabonetraker commented 8 months ago

I haven't faced any crashes so far after updating to xcode 15.1, so maybe yeah it was fixed with their update

navaronbracke commented 8 months ago

Then I will close this issue. If it ever happens again, we can reopen this issue.