flutter-ml / google_ml_kit_flutter

A flutter plugin that implements Google's standalone ML Kit
MIT License
991 stars 748 forks source link

App will ANR when using google_mlkit_digital_ink_recognition running check model function #598

Open empirejames opened 7 months ago

empirejames commented 7 months ago

Describe the bug When I download the google_ml_kit_flutter-develop sample code and running the digital ink recognize function, It's take for a while for initialize the digitalInkRecognizeFunction... (And the app will cause ANR)

To Reproduce Steps to reproduce the behavior:

  1. Download sample code [google_ml_kit_flutter-develop].
  2. Running it on debug or release mode
  3. Click Vision APIs (dropdown list)
  4. Click on Digital Ink Recognition function page's button "Check Model". (as attach picture)
  5. It will show a progress dialog. (The app still alive then touch the device screen)
  6. Wait for a moment and See error.
  7. Remove app and reinstall again can reproduce.
截圖 2024-04-01 下午5 40 16

Expected behavior The app will not showing ANR.

Platform (please complete the following information):

Running device log I/DIRecoDownload(27844): DigitalInkRecognitionFileDependencyManager() I/MddModelManager(27844): Start initialization I/MddModelManager(27844): isModelDownloadedAndValid() I/DIRecoDownload(27844): DigitalInkRecognitionFileDependencyManager.initialize(): Parse Manifest I/DIRecoDownload(27844): DigitalInkRecognitionManifestParser.parseManifest() I/e_mlkit_exampl(27844): ThreadFlipBegin blocked for 8.419ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 93646(4MB) AllocSpace objects, 2(48KB) LOS objects, 59% free, 4MB/10MB, paused 226us total 176.703ms W/e_mlkit_exampl(27844): Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection) I/DIRecoDownload(27844): DigitalInkRecognitionManifestParser.parseManifestFromAsset(): read 808 manifest entries I/DIRecoDownload(27844): DigitalInkRecognitionFileDependencyManager.initialize(): Parse packmapping I/DIRecoDownload(27844): DigitalInkRecognitionFileDependencyManager.initialize(): Read 725 pack mapping entries I/MddModelManager(27844): modelRegister initialized: true I/DIRecoDownload(27844): DigitalInkRecognitionFileDependencyManager: getAllFileGroupNames(). # Entries = 725 W/MDD (27844): MDDManager Clearing MDD since FilesMetadata failed or needs migration. I/e_mlkit_exampl(27844): Background concurrent copying GC freed 39103(1906KB) AllocSpace objects, 66(3MB) LOS objects, 55% free, 4MB/10MB, paused 156us total 132.243ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17718(726KB) AllocSpace objects, 106(5MB) LOS objects, 56% free, 4MB/10MB, paused 150us total 150.296ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 12058(508KB) AllocSpace objects, 110(5MB) LOS objects, 55% free, 4MB/10MB, paused 245us total 182.993ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 14898(624KB) AllocSpace objects, 106(5MB) LOS objects, 55% free, 4MB/10MB, paused 1.122ms total 125.151ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 11376(485KB) AllocSpace objects, 108(5MB) LOS objects, 56% free, 4MB/10MB, paused 217us total 178.070ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 14843(610KB) AllocSpace objects, 108(5MB) LOS objects, 55% free, 4MB/10MB, paused 204us total 139.820ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17211(703KB) AllocSpace objects, 104(5MB) LOS objects, 54% free, 4MB/10MB, paused 487us total 111.744ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17016(703KB) AllocSpace objects, 104(5MB) LOS objects, 55% free, 4MB/10MB, paused 229us total 126.432ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13249(563KB) AllocSpace objects, 108(5MB) LOS objects, 55% free, 4MB/10MB, paused 4.345ms total 108.740ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13930(578KB) AllocSpace objects, 110(5MB) LOS objects, 54% free, 4MB/10MB, paused 217us total 126.583ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 12652(529KB) AllocSpace objects, 106(5MB) LOS objects, 51% free, 5MB/11MB, paused 207us total 181.245ms I/e_mlkit_exampl(27844): Thread[3,tid=27857,WaitingInMainSignalCatcherLoop,Thread*=0x7acf016400,peer=0x169800e8,"Signal Catcher"]: reacting to signal 3 I/e_mlkit_exampl(27844): I/e_mlkit_exampl(27844): Wrote stack traces to '[tombstoned]' I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17030(685KB) AllocSpace objects, 120(6MB) LOS objects, 55% free, 4MB/10MB, paused 201us total 173.464ms F/crash_dump64(28028): crash_dump.cpp:490] failed to attach to thread 968, already traced by 0 () I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13972(579KB) AllocSpace objects, 106(5MB) LOS objects, 54% free, 5MB/11MB, paused 286us total 195.206ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13838(579KB) AllocSpace objects, 108(5MB) LOS objects, 52% free, 5MB/11MB, paused 191us total 204.862ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 16845(702KB) AllocSpace objects, 114(5MB) LOS objects, 53% free, 5MB/11MB, paused 4.910ms total 301.627ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13435(563KB) AllocSpace objects, 112(5MB) LOS objects, 54% free, 5MB/11MB, paused 213us total 203.513ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 16126(658KB) AllocSpace objects, 106(5MB) LOS objects, 53% free, 5MB/11MB, paused 198us total 367.661ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 14035(610KB) AllocSpace objects, 110(5MB) LOS objects, 53% free, 5MB/11MB, paused 191us total 226.958ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 16455(651KB) AllocSpace objects, 110(5MB) LOS objects, 55% free, 4MB/10MB, paused 229us total 147.898ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13384(563KB) AllocSpace objects, 110(5MB) LOS objects, 54% free, 4MB/10MB, paused 190us total 139.267ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13209(554KB) AllocSpace objects, 106(5MB) LOS objects, 54% free, 5MB/11MB, paused 2.713ms total 167.964ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13304(546KB) AllocSpace objects, 108(5MB) LOS objects, 53% free, 5MB/11MB, paused 2.632ms total 157.386ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 12095(515KB) AllocSpace objects, 112(5MB) LOS objects, 55% free, 4MB/10MB, paused 3.278ms total 123.335ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 16940(701KB) AllocSpace objects, 108(5MB) LOS objects, 54% free, 5MB/11MB, paused 204us total 177.751ms I/e_mlkit_exampl(27844): Waiting for a blocking GC ProfileSaver I/e_mlkit_exampl(27844): Background concurrent copying GC freed 18026(736KB) AllocSpace objects, 102(5MB) LOS objects, 52% free, 5MB/11MB, paused 1.586ms total 253.643ms I/e_mlkit_exampl(27844): WaitForGcToComplete blocked ProfileSaver on HeapTrim for 113.791ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 12488(531KB) AllocSpace objects, 114(5MB) LOS objects, 54% free, 4MB/10MB, paused 225us total 123.745ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17792(707KB) AllocSpace objects, 106(5MB) LOS objects, 55% free, 4MB/10MB, paused 1.874ms total 183.277ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13420(563KB) AllocSpace objects, 108(5MB) LOS objects, 54% free, 4MB/10MB, paused 7.044ms total 153.907ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 14768(616KB) AllocSpace objects, 104(5MB) LOS objects, 54% free, 5MB/11MB, paused 3.100ms total 194.732ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17329(720KB) AllocSpace objects, 104(5MB) LOS objects, 55% free, 4MB/10MB, paused 1.003ms total 141.851ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 16272(673KB) AllocSpace objects, 106(5MB) LOS objects, 53% free, 5MB/11MB, paused 208us total 194.474ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 16384(688KB) AllocSpace objects, 104(5MB) LOS objects, 54% free, 4MB/10MB, paused 193us total 125.041ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13414(562KB) AllocSpace objects, 108(5MB) LOS objects, 55% free, 4MB/10MB, paused 219us total 139.228ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 19144(768KB) AllocSpace objects, 106(5MB) LOS objects, 53% free, 5MB/11MB, paused 222us total 156.867ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 15270(642KB) AllocSpace objects, 106(5MB) LOS objects, 55% free, 4MB/10MB, paused 5.790ms total 132.160ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17034(692KB) AllocSpace objects, 108(5MB) LOS objects, 54% free, 4MB/10MB, paused 203us total 182.912ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 16690(688KB) AllocSpace objects, 104(5MB) LOS objects, 55% free, 4MB/10MB, paused 211us total 128.533ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17124(711KB) AllocSpace objects, 104(5MB) LOS objects, 53% free, 5MB/11MB, paused 8.057ms total 156.226ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 13205(563KB) AllocSpace objects, 108(5MB) LOS objects, 54% free, 4MB/10MB, paused 204us total 155.081ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 17189(719KB) AllocSpace objects, 104(5MB) LOS objects, 55% free, 4MB/10MB, paused 459us total 193.369ms I/e_mlkit_exampl(27844): Background concurrent copying GC freed 16004(657KB) AllocSpace objects, 104(5MB) LOS objects, 54% free, 4MB/10MB, paused 202us total 103.931ms I/MddModelManager(27844): registerFileGroups(): Done. I/MddModelManager(27844): File groups registered: true I/MddModelManager(27844): download(): Download for model RemoteModel{modelName=digital_ink_recognition_model_com.google.mlkit.vision.digitalink.DigitalInkRecognitionModelIdentifier@a3b52161, baseModel=null, modelType=DIGITAL_INK} D/InputMethodManager(27844): prepareNavigationBarInfo() DecorView@f5a3b01[MainActivity] D/InputMethodManager(27844): getNavigationBarColor() -855310 D/ViewRootImpl@2cbd783MainActivity: ViewPostIme pointer 0 D/ViewRootImpl@2cbd783MainActivity: ViewPostIme pointer 1 D/ViewRootImpl@2cbd783MainActivity: ViewPostIme pointer 0 I/Choreographer(27844): Skipped 5448 frames! The application may be doing too much work on its main thread. D/ViewRootImpl@2cbd783MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 0 D/TransportRuntime.SQLiteEventStore(27844): Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for destination cct D/TransportRuntime.JobInfoScheduler(27844): Scheduling upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) with jobId=327165724 in 86400000ms(Backend next call timestamp 0). Attempt 1 D/TransportRuntime.SQLiteEventStore(27844): Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for destination cct D/TransportRuntime.JobInfoScheduler(27844): Upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning... D/NetworkSecurityConfig(27844): No Network Security Config specified, using platform default W/e_mlkit_exampl(27844): Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (light greylist, reflection) W/e_mlkit_exampl(27844): Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (light greylist, reflection) W/e_mlkit_exampl(27844): Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (light greylist, reflection) D/OffroadFileDownloader(27844): Data download scheduled for file: https://dl.google.com/handwriting/models/qrnn.en.reco_20200318.fst_20191208.recospec.zip D/zzxs (27844): Starting download: https://dl.google.com/handwriting/models/qrnn.en.reco_20200318.fst_20191208.recospec.zip V/zzxs (27844): Is http uri, downloading (uri: https://dl.google.com/handwriting/models/qrnn.en.reco_20200318.fst_20191208.recospec.zip) D/OffroadFileDownloader(27844): Data download scheduled for file: https://dl.google.com/handwriting/models/indy_lstm.latin.6x216.tflite.20191208.zip D/OffroadFileDownloader(27844): Data download scheduled for file: https://dl.google.com/handwriting/models/en.20191208.compact.fst.zip D/zzxs (27844): Starting download: https://dl.google.com/handwriting/models/indy_lstm.latin.6x216.tflite.20191208.zip V/zzxs (27844): Is http uri, downloading (uri: https://dl.google.com/handwriting/models/indy_lstm.latin.6x216.tflite.20191208.zip) D/NetworkManagementSocketTagger(27844): tagSocket(110) with statsTag=0xffffffff, statsUid=-1 D/NetworkManagementSocketTagger(27844): tagSocket(109) with statsTag=0xffffffff, statsUid=-1 W/e_mlkit_exampl(27844): Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection) W/e_mlkit_exampl(27844): Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getAlpnSelectedProtocol()[B (light greylist, reflection) D/DownloadCompleteHandler(27844): Downloaded file datadownloadfile_1711964375757_6c7afaf3d49b457796555bfe1defa87a7a84dff1 D/zzxs (27844): Starting download: https://dl.google.com/handwriting/models/en.20191208.compact.fst.zip V/zzxs (27844): Is http uri, downloading (uri: https://dl.google.com/handwriting/models/en.20191208.compact.fst.zip) I/e_mlkit_exampl(27844): Background concurrent copying GC freed 39365(2MB) AllocSpace objects, 33(1556KB) LOS objects, 49% free, 7MB/15MB, paused 1.227ms total 453.435ms D/DownloadCompleteHandler(27844): Downloaded file datadownloadfile_1711964375617_27cfb1b5a7e5a4dee7ba6c07aaea9c3343b34ee4 D/DownloadCompleteHandler(27844): Downloaded file datadownloadfile_1711964375758_e658bab006ee49265531934194b332cc0ddd6c7d I/MddModelManager(27844): download: complete I/MddModelManager(27844): download: returned with status 1

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.