Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

[BUG]: Manage Note Types: 'Progress dialog' may not close when system is under load

Open david-allison opened this issue 1 month ago • 6 comments

2.23beta3, commit 5457f48e80c00ee28ae5edc91569facb6b7f75bf

  • Put my the PC under load (full unit test run)
  • Have a large collection (I created 200k test notes in the developer settings)
  • Manage Note types - Add - Backspace two character, click OK
    • AddNewNotesType
  • Repeat until the progress dialog gets stuck on the screen
    • This took me 3 minutes - seems pointless to provide the video
23:07:26.275  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:07:26.276  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:07:27.159  7874-7874  AssistStructure          I  Flattened final assist data: 3640 bytes, containing 2 windows, 28 views
23:07:28.206  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onAttach
23:07:28.207  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onCreate
23:07:28.236  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStart
23:07:28.236  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onResume
23:07:28.239  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onPause
23:07:28.240  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStop
23:07:28.245  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onViewDestroyed
23:07:28.246  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDestroy
23:07:28.246  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDetach
23:07:28.281  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:07:28.281  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:07:29.311  7874-7874  AssistStructure          I  Flattened final assist data: 3640 bytes, containing 2 windows, 28 views
23:07:31.205  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onAttach
23:07:31.205  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onCreate
23:07:31.262  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStart
23:07:31.262  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onResume
23:07:31.353  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onPause
23:07:31.354  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStop
23:07:31.385  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onViewDestroyed
23:07:31.386  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDestroy
23:07:31.387  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDetach
23:07:31.487  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:07:31.488  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:07:40.641  7874-7874  AssistStructure          I  Flattened final assist data: 3640 bytes, containing 2 windows, 28 views
23:07:43.875  7874-7874  InputEventReceiver       W  Attempted to finish an input event but the input event receiver has already been disposed.
23:07:43.875  7874-7874  Choreographer            I  Skipped 38 frames!  The application may be doing too much work on its main thread.
23:07:43.876  7874-7874  RemoteInpu...ectionImpl  W  getSurroundingText on inactive InputConnection
23:07:44.028  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onAttach
23:07:44.029  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onCreate
23:07:44.095  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStart
23:07:44.096  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onResume
23:07:44.362  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onPause
23:07:44.364  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStop
23:07:44.708  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onViewDestroyed
23:07:44.709  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDestroy
23:07:44.709  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDetach
23:07:44.710  7874-7874  RemoteInpu...ectionImpl  W  getTextBeforeCursor on inactive InputConnection
23:07:44.719  7874-7874  Choreographer            I  Skipped 36 frames!  The application may be doing too much work on its main thread.
23:07:44.914  7874-7874  RemoteInpu...ectionImpl  W  getTextBeforeCursor on inactive InputConnection
23:07:44.973  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:07:45.306  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:07:47.963  7874-7874  Choreographer            I  Skipped 43 frames!  The application may be doing too much work on its main thread.
23:07:48.312  7874-7874  AssistStructure          I  Flattened final assist data: 3640 bytes, containing 2 windows, 28 views
23:07:50.447  7874-7874  RemoteInpu...ectionImpl  W  getTextBeforeCursor on inactive InputConnection
23:07:50.449  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onAttach
23:07:50.450  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onCreate
23:07:50.664  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStart
23:07:50.664  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onResume
23:07:50.665  7874-7874  InputEventReceiver       W  Attempted to finish an input event but the input event receiver has already been disposed.
23:07:50.665  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onPause
23:07:50.666  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStop
23:07:50.786  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onViewDestroyed
23:07:50.786  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDestroy
23:07:50.786  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDetach
23:07:50.844  7874-7874  RemoteInpu...ectionImpl  W  getSurroundingText on inactive InputConnection
23:07:50.882  7874-7874  RemoteInpu...ectionImpl  W  getTextBeforeCursor on inactive InputConnection
23:07:51.039  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:07:51.040  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:07:53.063  7874-7874  Choreographer            I  Skipped 30 frames!  The application may be doing too much work on its main thread.
23:07:53.159  7874-7874  AssistStructure          I  Flattened final assist data: 3640 bytes, containing 2 windows, 28 views
23:07:55.261  7874-7874  InputEventReceiver       W  Attempted to finish an input event but the input event receiver has already been disposed.
23:07:55.261  7874-7874  Choreographer            I  Skipped 35 frames!  The application may be doing too much work on its main thread.
23:07:55.266  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onAttach
23:07:55.271  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onCreate
23:07:55.579  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStart
23:07:55.579  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onResume
23:07:55.580  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onPause
23:07:55.580  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStop
23:07:55.607  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onViewDestroyed
23:07:55.607  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDestroy
23:07:55.607  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDetach
23:07:55.852  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:07:55.852  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:07:57.605  7874-7874  AssistStructure          I  Flattened final assist data: 3640 bytes, containing 2 windows, 28 views
23:07:58.938  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onAttach
23:07:59.025  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onCreate
23:07:59.154  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStart
23:07:59.155  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onResume
23:07:59.480  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onPause
23:07:59.480  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStop
23:07:59.559  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onViewDestroyed
23:07:59.560  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDestroy
23:07:59.560  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDetach
23:07:59.855  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:07:59.855  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:08:00.001  7874-7874  DayRolloverHandler       V  received android.intent.action.TIME_TICK
23:08:01.469  7874-7874  AssistStructure          I  Flattened final assist data: 3640 bytes, containing 2 windows, 28 views
23:08:03.055  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onAttach
23:08:03.057  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onCreate
23:08:03.327  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStart
23:08:03.327  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onResume
23:08:03.940  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onPause
23:08:03.941  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStop
23:08:04.027  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onViewDestroyed
23:08:04.028  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDestroy
23:08:04.028  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDetach
23:08:04.233  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:08:04.233  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:08:05.637  7874-7874  AssistStructure          I  Flattened final assist data: 3640 bytes, containing 2 windows, 28 views
23:08:07.375  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onAttach
23:08:07.384  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onCreate
23:08:07.667  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStart
23:08:07.667  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onResume
23:08:08.008  7874-7874  ImeBackDispatcher        E  Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 73577934
23:08:08.008  7874-7874  RemoteInpu...ectionImpl  W  requestCursorAnchorInfo on inactive InputConnection
23:08:15.574  7874-7874  InputEventReceiver       W  Attempted to finish an input event but the input event receiver has already been disposed.
23:08:15.583  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onPause
23:08:15.594  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onStop
23:08:15.602  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onViewDestroyed
23:08:15.603  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDestroy
23:08:15.603  7874-7874  FragmentLifecycleLogger  I  ManageNotetypes::LoadingDialogFragment::onDetach
23:08:17.595  7874-7874  AnkiActivity             I  Home button pressed
23:08:17.598  7874-7874  AnkiActivity             V  onActionBarBackPressed
23:08:17.657  7874-7874  AnkiActivity             I  finishWithAnimation DEFAULT
23:08:17.760  7874-7874  AnkiDroidApp$onCreate    I  ManageNotetypes::onPause
23:08:17.975  7874-7874  AnkiDroidApp$onCreate    I  DeckPicker::onStart
23:08:18.010  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onStart
23:08:18.078  7874-7874  AnkiDroidApp$onCreate    I  DeckPicker::onResume
23:08:18.079  7874-7874  UsageAnalytics           D  sendAnalyticsScreenView(): DeckPicker
23:08:18.079  7874-7874  UsageAnalytics           D  getOptIn() status: false
23:08:18.096  7874-8130  DeckPicker...teDeckList  D  updateDeckList
23:08:18.161  7874-7874  StudyOptionsFragment     D  Refreshing StudyOptionsFragment
23:08:18.163  7874-8130  DeckPicker...DeckCounts  D  Refreshing deck list
23:08:18.210  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onResume
23:08:18.225  7874-7874  DeckPicker               D  onStartupResponse: Success
23:08:18.226  7874-7874  InitialActivity          D  Not a fresh install [preferences]
23:08:18.226  7874-7874  DeckPicker               I  No startup screens required
23:08:18.229  7874-7874  DeckPicker               D  autoSync: not enabled
23:08:18.234  7874-7874  DeckPicker               D  onCreateOptionsMenu()
23:08:18.417  7874-7874  BadgeDrawableBuilder     D  Adding badge
23:08:18.469  7874-7874  StudyOptionsFragment     I  configureToolbarInternal()
23:08:28.381  7874-7874  CollectionManager        W  blocked main thread for 9911ms:
                                                     com.ichi2.anki.StudyOptionsFragment.getCol(StudyOptionsFragment.kt:374)
23:08:28.779  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onPause
23:08:28.779  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onStop
23:08:28.780  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onAttach
23:08:28.787  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onCreate
23:08:28.788  7874-7874  StudyOptionsFragment     I  onCreateView()
23:08:28.951  7874-7874  StudyOptionsFragment     D  Refreshing StudyOptionsFragment
23:08:28.971  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onViewCreated
23:08:28.972  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onStart
23:08:28.976  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onViewDestroyed
23:08:28.977  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onDestroy
23:08:28.977  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onDetach
23:08:28.977  7874-7874  StudyOptionsFragment     D  Refreshing StudyOptionsFragment
23:08:33.153  7874-7874  CollectionManager        W  blocked main thread for 4169ms:
                                                     com.ichi2.anki.StudyOptionsFragment$refreshInterface$1.invokeSuspend(StudyOptionsFragment.kt:341)
23:08:33.160  7874-7874  FragmentLifecycleLogger  I  DeckPicker::StudyOptionsFragment::onResume
23:08:33.165  7874-7874  Choreographer            I  Skipped 895 frames!  The application may be doing too much work on its main thread.
23:08:33.169  7874-7874  DeckPicker               D  onCreateOptionsMenu()
23:08:33.266  7874-7874  BadgeDrawableBuilder     D  Adding badge
23:08:33.271  7874-7874  StudyOptionsFragment     I  configureToolbarInternal()
23:08:36.372  7874-7874  CollectionManager        W  blocked main thread for 3097ms:
                                                     com.ichi2.anki.StudyOptionsFragment.getCol(StudyOptionsFragment.kt:374)
23:08:36.529  7874-7874  CoroutineH...$dialogJob  I  Displaying progress dialog: 600ms elapsed; 
                                                     cancellable: false; 
                                                     manualCancel: false
23:08:36.783  7874-7874  DeckPicker...OfDeckList  I  currentDeckId: 1
23:08:36.785  7874-7874  BackupPromptDialog       V  Collection may be removed on uninstall
23:08:36.791  7874-7874  AnkiDroidApp$onCreate    I  ManageNotetypes::onStop
23:08:36.817  7874-7874  AnkiDroidApp$onCreate    I  ManageNotetypes::onDestroy

david-allison avatar Nov 23 '25 23:11 david-allison

@lukstbit FYI

  • likely: https://github.com/ankidroid/Anki-Android/pull/17804

david-allison avatar Nov 23 '25 23:11 david-allison

Attempted to reproduce; under system load but was unable to trigger the race condition. Will give it a try again later!

xenonnn4w avatar Nov 25 '25 18:11 xenonnn4w

here I replaced the per-call dialogs and global boolean with a single ProgressDialogManager that tracks owners, delays showing safely, dismisses when the last 1 hides, and manages FLAG_NOT_TOUCHABLE/logging to prevent stuck dialogs under heavy load

7se7en72025 avatar Nov 27 '25 18:11 7se7en72025

here I replaced the per-call dialogs and global boolean with a single ProgressDialogManager that tracks owners, delays showing safely, dismisses when the last 1 hides, and manages FLAG_NOT_TOUCHABLE/logging to prevent stuck dialogs under heavy load

before that, are you able to reproduce the same?

xenonnn4w avatar Nov 28 '25 16:11 xenonnn4w

I kept lint error check, 2 high end games running in bg and then added test notes and doing the backspace thing,it took me around 4.5 minutes for it to hang.

7se7en72025 avatar Nov 28 '25 16:11 7se7en72025

The first step would be creating a patch which reproduces this consistently, or a test, if possible.

david-allison avatar Nov 29 '25 16:11 david-allison