[ML Kit Bug] Text Recognition Causes Crash
See original GitHub issueI haven’t experienced this bug personally but I keep seeing this crash (about 10 crashes for 2 users in the last month) appearing on Crashalytics.
Firebase version: 5.20.2
Podfile.lock:
- Firebase/MLVision (5.20.2):
- Firebase/CoreOnly
- FirebaseMLVision (= 0.15.0)
- Firebase/MLVisionTextModel (5.20.2):
- Firebase/CoreOnly
- FirebaseMLVisionTextModel (= 0.15.0)
Device:
Model: iPhone XS Max
Orientation: Portrait
RAM free: 477.13 MB
Disk free: 65.87 GB
Version: 12.3.1 (16F203)
Orientation: Portrait
Jailbroken: No
Stack Trace:
EXC_BREAKPOINT 0x00000001ba81f748
Crashed: com.google.firebaseml.textrecognition
0 libsystem_malloc.dylib 0x1ba81f748 nanov2_allocate_from_block + 580
1 ??? 0x443d01ba81e86c (Missing)
2 ??? 0x180f01ba81e7a0 (Missing)
3 ??? 0x664e81ba824ea4 (Missing)
4 ??? 0x4a8b01ba822b68 (Missing)
5 ??? 0x718001ba8235ec (Missing)
6 ??? 0x14e081b9e37570 (Missing)
7 ??? 0x38808103498540 (Missing)
8 MyApp 0x10346eb08 ocr::photo::jni_helper::RecognizeRawDataWithBoxAndAssistAndDetections(unsigned char const*, int, int, int, int, int, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, int, int, int, std::__1::vector<ocr::photo::TextBox, std::__1::allocator<ocr::photo::TextBox> > const&, std::__1::vector<ocr::photo::DetectionBox, std::__1::allocator<ocr::photo::DetectionBox> > const&, ocr::photo::QueryOptions const&, ocr::photo::QueryMetaResults*, std::__1::vector<ocr::photo::LineBox, std::__1::allocator<ocr::photo::LineBox> >*) + 4375816968
9 MyApp 0x103063dd8 -[GMVTextDetector textsInImageBufferData:colorModel:startDate:width:height:options:orientation:format:] + 4371578328
10 MyApp 0x102ef93a4 __51-[FIRVisionTextRecognizer processImage:completion:]_block_invoke + 4370092964
11 libdispatch.dylib 0x1ba658304 _dispatch_call_block_and_release + 32
12 ??? 0x5c1301ba659884 (Missing)
13 ??? 0x17d01ba660dd4 (Missing)
14 ??? 0x6cf781ba661918 (Missing)
15 ??? 0xb5101ba669cc0 (Missing)
16 ??? 0x8a701ba854a98 (Missing)
17 ??? 0x249981ba85adc4 (Missing)
com.apple.main-thread
com.apple.main-thread
0 libsystem_kernel.dylib 0x1ba7d1c60 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1ba7d10e8 mach_msg + 76
2 ??? 0xc0c81babd9e10 (Missing)
3 ??? 0x279c81babd4ab4 (Missing)
4 ??? 0x5dbf81babd4254 (Missing)
5 ??? 0x47f401bce13d8c (Missing)
6 ??? 0x6f8101e7f1c4c0 (Missing)
7 ??? 0x7dcf8102c452dc (Missing)
8 libdyld.dylib 0x1ba690fd8 start + 4
Thread firebase/quickstart-ios#1
Thread
0 libsystem_kernel.dylib 0x1ba7ddb64 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ba854abc _pthread_wqthread + 344
2 ??? 0x1ac681ba85adc4 (Missing)
Thread firebase/quickstart-ios#2
Thread
0 libsystem_kernel.dylib 0x1ba7ddb64 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ba854abc _pthread_wqthread + 344
2 ??? 0x113c81ba85adc4 (Missing)
Thread firebase/quickstart-ios#3
Thread
0 libsystem_kernel.dylib 0x1ba7ddb64 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ba854b7c _pthread_wqthread + 536
2 ??? 0x58e081ba85adc4 (Missing)
com.apple.uikit.eventfetch-thread
com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1ba7d1c60 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1ba7d10e8 mach_msg + 76
2 ??? 0x4a2d81babd9e10 (Missing)
3 ??? 0x1a8c01babd4ab4 (Missing)
4 ??? 0x619081babd4254 (Missing)
5 ??? 0x1d4c81bb5b404c (Missing)
6 ??? 0x40e581bb5b3ed4 (Missing)
7 ??? 0x32b01e80080d4 (Missing)
8 ??? 0x198301bb5b2c4c (Missing)
9 ??? 0x646901bb6e8e54 (Missing)
10 ??? 0x1da481ba852908 (Missing)
11 ??? 0x47b781ba852864 (Missing)
12 ??? 0x1b1301ba85adcc (Missing)
Thread firebase/quickstart-ios#4
Thread
0 libsystem_kernel.dylib 0x1ba7ddb64 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ba854b7c _pthread_wqthread + 536
2 ??? 0x7ba181ba85adc4 (Missing)
Thread firebase/quickstart-ios#5
Thread
0 libsystem_kernel.dylib 0x1ba7ddb64 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ba854abc _pthread_wqthread + 344
2 ??? 0x666001ba85adc4 (Missing)
Thread firebase/quickstart-ios#6
Thread
0 libsystem_kernel.dylib 0x1ba7ddb64 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ba854b7c _pthread_wqthread + 536
2 ??? 0x5e5b01ba85adc4 (Missing)
com.apple.mobileslideshow.accessCallbacks
com.apple.mobileslideshow.accessCallbacks
0 libsystem_kernel.dylib 0x1ba7d1c9c semaphore_wait_trap + 8
1 libdispatch.dylib 0x1ba659f6c _dispatch_sema4_wait + 28
2 ??? 0x192e81ba65aa24 (Missing)
3 ??? 0x56c30102cbd3f8 (Missing)
4 RealmSwift 0x1049f3f5c Realm.write(_:) (Realm.swift:155)
5 MyApp 0x102cbb048 specialized closure firebase/quickstart-ios#4 in closure firebase/quickstart-ios#1 in ScanControllerObject.scanPhotos(assetArray:) (ScanControllerObject.swift:395)
6 MyApp 0x102cc1300 partial apply for specialized (<compiler-generated>)
7 MyApp 0x102cca8e8 thunk for @escaping @callee_guaranteed (@guaranteed UIImage?, @guaranteed [AnyHashable : Any]?) -> () (<compiler-generated>)
8 Photos 0x1c99367ec __84-[PHImageManager requestImageForAsset:targetSize:contentMode:options:resultHandler:]_block_invoke_3 + 328
9 ??? 0x4c9701c992b10c (Missing)
10 ??? 0x73c201c992fab4 (Missing)
11 ??? 0x7d8e01c992e0b8 (Missing)
12 ??? 0x2c3b81c9931324 (Missing)
13 ??? 0x5d6701c9936308 (Missing)
14 ??? 0x4c1501c9939a00 (Missing)
15 ??? 0x44758102cb9d88 (Missing)
16 MyApp 0x102ccadac thunk for @escaping @callee_guaranteed (@guaranteed PHAsset, @unowned Int, @unowned UnsafeMutablePointer<ObjCBool>) -> () (<compiler-generated>)
17 CoreFoundation 0x1bac28d24 __NSArrayEnumerate + 420
18 ??? 0x6dc801c9a22bd0 (Missing)
19 ??? 0x21d48102cb8d30 (Missing)
20 MyApp 0x102cb84d0 closure firebase/quickstart-ios#1 in ScanControllerObject.setupObject() (PhotoLibraryManager.swift:17)
21 MyApp 0x102cf28bc thunk for @escaping @callee_guaranteed (@unowned PHAuthorizationStatus) -> () (<compiler-generated>)
22 Photos 0x1c995400c __39+[PHPhotoLibrary requestAuthorization:]_block_invoke + 88
23 ??? 0x766e81c86ccc84 (Missing)
24 ??? 0x7a981c86b3490 (Missing)
25 ??? 0x47c01ba658304 (Missing)
26 ??? 0x344a81ba659884 (Missing)
27 ??? 0x370781ba660dd4 (Missing)
28 ??? 0x1a4501ba661918 (Missing)
29 ??? 0x570781ba669cc0 (Missing)
30 ??? 0xb6d81ba854a98 (Missing)
31 ??? 0x2b4001ba85adc4 (Missing)
Thread firebase/quickstart-ios#7
Thread
0 libsystem_kernel.dylib 0x1ba7ddb64 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ba854abc _pthread_wqthread + 344
2 ??? 0x7b1d01ba85adc4 (Missing)
com.twitter.crashlytics.ios.MachExceptionServer
com.twitter.crashlytics.ios.MachExceptionServer
0 MyApp 0x102d20bcc CLSProcessRecordAllThreads (CLSProcess.c:376)
1 MyApp 0x102d20fb4 CLSProcessRecordAllThreads (CLSProcess.c:407)
2 MyApp 0x102d10938 CLSHandler (CLSHandler.m:26)
3 MyApp 0x102d0bd28 CLSMachExceptionServer (CLSMachException.c:446)
4 libsystem_pthread.dylib 0x1ba852908 _pthread_body + 132
5 ??? 0x332d01ba852864 (Missing)
6 ??? 0x507101ba85adcc (Missing)
Thread firebase/quickstart-ios#8
Thread
0 libsystem_kernel.dylib 0x1ba7ddb64 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ba854abc _pthread_wqthread + 344
2 ??? 0x11fd01ba85adc4 (Missing)
Thread firebase/quickstart-ios#9
Thread
0 libsystem_pthread.dylib 0x1ba85adc0 start_wqthread + 254
com.apple.NSURLConnectionLoader
com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x1ba7d1c60 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1ba7d10e8 mach_msg + 76
2 ??? 0x178a01babd9e10 (Missing)
3 ??? 0xac401babd4ab4 (Missing)
4 ??? 0x4ad01babd4254 (Missing)
5 ??? 0xf5f81bb1f5c88 (Missing)
6 ??? 0xeea01bb5b2c4c (Missing)
7 ??? 0x4a6f81bb6e8e54 (Missing)
8 ??? 0x6cc381ba852908 (Missing)
9 ??? 0x74781ba852864 (Missing)
10 ??? 0x3db781ba85adcc (Missing)
H11ANEServicesThread
H11ANEServicesThread
0 libsystem_kernel.dylib 0x1ba7d1c60 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1ba7d10e8 mach_msg + 76
2 ??? 0x649581babd9e10 (Missing)
3 ??? 0x796d01babd4ab4 (Missing)
4 ??? 0x16d81babd4254 (Missing)
5 ??? 0x551b81babd4f88 (Missing)
6 ??? 0x3d5101e4210a04 (Missing)
7 ??? 0x2c701ba852908 (Missing)
8 ??? 0x224f81ba852864 (Missing)
9 ??? 0x2f3c01ba85adcc (Missing)
H11ANEServicesThread
H11ANEServicesThread
0 libsystem_kernel.dylib 0x1ba7d1c60 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1ba7d10e8 mach_msg + 76
2 ??? 0x196f01babd9e10 (Missing)
3 ??? 0x4a6001babd4ab4 (Missing)
4 ??? 0x605a81babd4254 (Missing)
5 ??? 0x3e5981babd4f88 (Missing)
6 ??? 0x4c6881e4210a04 (Missing)
7 ??? 0x4c7501ba852908 (Missing)
8 ??? 0x613d01ba852864 (Missing)
9 ??? 0x33a581ba85adcc (Missing)
Thread firebase/quickstart-ios#10
Thread
0 libsystem_kernel.dylib 0x1ba7defc8 poll + 8
1 MyApp 0x1037db04c (anonymous namespace)::ExitTimeoutWatcher(void*) + 4379406412
2 libsystem_pthread.dylib 0x1ba852908 _pthread_body + 132
3 ??? 0x62b801ba852864 (Missing)
4 ??? 0x528c01ba85adcc (Missing)
Thread firebase/quickstart-ios#11
Thread
0 libsystem_kernel.dylib 0x1ba7defc8 poll + 8
1 MyApp 0x1037daf2c (anonymous namespace)::ThreadLivenessWatcher(void*) + 4379406124
2 libsystem_pthread.dylib 0x1ba852908 _pthread_body + 132
3 ??? 0x6fb601ba852864 (Missing)
4 ??? 0x2c6701ba85adcc (Missing)
RLMRealm notification listener
RLMRealm notification listener
0 libsystem_kernel.dylib 0x1ba7de8e4 kevent + 8
1 Realm 0x10453f588 realm::_impl::ExternalCommitHelper::listen() (external_commit_helper.cpp:217)
2 Realm 0x1045400d4 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >(void*) (tuple:170)
3 libsystem_pthread.dylib 0x1ba852908 _pthread_body + 132
4 ??? 0x63ee01ba852864 (Missing)
5 ??? 0x376901ba85adcc (Missing)
Any idea how to fix this? Help is greatly appreciated as I’ve been getting complains from users.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14
Top Results From Across the Web
Google ML Kit Text Recognition(v16.1.3) crashes after ...
After upgrading the Text Recognition dependency from 16.1.
Read more >Known issues | ML Kit - Google Developers
For the Text Recognition, Image Labeling, and Object Detection and Tracking APIs, the performance with CameraX and Camera2 is still not on par...
Read more >[ML Kit Bug] Text Recognition Causes Crash - - Bountysource
[ML Kit Bug] Text Recognition Causes Crash. ... this crash (about 10 crashes for 2 users in the last month) appearing on Crashalytics....
Read more >Recognize Text in Images with ML Kit on iOS - Firebase
For ML Kit to accurately recognize text, input images must contain text that is represented by sufficient pixel data. · Poor image focus...
Read more >[ML Kit] Language ID SIGSEGV crashes ... - Issue Tracker
I have released a new version of my application in beta track and started receiving lots of crashes from liblanguage_id_jni. It is used...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t have exact pattern how to reproduce this, but some characteristics:
It never crashes when scanning ‘empty’ space that has nothing to detect.
When it crashes, it always has detected something 2.1) Usually the patterns is such that I let it start scanning so that the camera is pointing to table (black image) and then after a while I take it into use and it crashes almost immediately when it gets something to detect. However, sometimes it shows some detected results, so it is able to run a few frames, but not always. 2.2) sometimes the crash happens in matter of seconds, sometimes it takes several minutes of scanning different test material.
The FIRVisionTextRecognizer.process eats memory slowly, but faster when it detects something.
This last one is just a hunch, but I think it crashes only when UIImage is given to VisionImage. If CMSampleBuffer is used, I have not experienced any crashes ever. BUT, it could be because the UIImage we use is cropped and smaller than the SampleBuffer (which is full hd view finder image), thus the smaller image gets processed faster and more detections are executed. It could be that I haven’t run the sample buffer version long enough or something. CMSampleBuffer version has worked +20 minutes without crashes and this UIImage version seems to crash in a few minutes. There is definitely a difference here.
We noticed that FIRVisionTextRecognizer.process crashes notably more frequently in iPad Pro than with phones, but that maybe be because of many reasons: amount of memory, camera view finder resolution size, different iOS version, etc… Anyway, we use iPad Pro as test device, it almost guarantees a crash in a few minutes.
I will try upgrading to Firebase 6.2.0 and let’s see if it makes any difference.
I can confirm this, we get exactly same kind of crash logs and we are even able to reproduce this quite frequently even when debugging.