Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kiwix doesn't clean properly downloading zim and crash. #826

Closed
mgautierfr opened this issue Jul 30, 2018 · 4 comments
Closed

Kiwix doesn't clean properly downloading zim and crash. #826

mgautierfr opened this issue Jul 30, 2018 · 4 comments
Labels
Milestone

Comments

@mgautierfr
Copy link
Member

Description

Using the last version of the multi-arch nightly apk (http://download.kiwix.org/nightly/2018-07-29/kiwix-android-debug.apk), it seems that kiwix doesn't correctly clear a stopped download, keep display it and crash when user want to interact with it.

  • No local zim.
  • apk newly installed.
  • press "getContent"
  • press "ONLINE" tab
  • select a zim to download
  • kiwix move automatically to "DOWNLOADING" tab and start the download of the zim.
  • move to "ONLINE" tab and start a new download.
  • stop a download (using the square) and confirm the "Stop download?" dialog
  • the download seems to be stopped and it is no more display in the downloading list.
  • move to "ONLINE" tab.
  • move to "DOWNLOADING" tab again (without starting a download)
  • There is two download in the list. The stopped download is still there.
  • Stop again the "wrong" download item.
  • Kiwix crash.

It seems that the bug appears if there are several download in the same time.
If there is one download, stopping it seems to correctly stop it.
Order of operations seems not relevant, you can also download two zims in a row, stop one and change tab the see the bug appearing.

Environment

  • Version of Kiwix Android : 2.3 Build 55. (nightly 2018-07-29)
  • Device : Moto G4 plus
  • OS version : Android 7.0

Log

Using adb logcat kiwix *:E :

07-30 15:21:34.465  4603  4603 E AndroidRuntime: FATAL EXCEPTION: main
07-30 15:21:34.465  4603  4603 E AndroidRuntime: Process: org.kiwix.kiwixmobile, PID: 4603
07-30 15:21:34.465  4603  4603 E AndroidRuntime: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at java.util.ArrayList.get(ArrayList.java:411)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at org.kiwix.kiwixmobile.downloader.DownloadService.pauseDownload(DownloadService.java:266)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at org.kiwix.kiwixmobile.downloader.DownloadFragment$DownloadAdapter.setPlayState(DownloadFragment.java:227)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at org.kiwix.kiwixmobile.downloader.DownloadFragment$DownloadAdapter.lambda$getView$5(DownloadFragment.java:286)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at org.kiwix.kiwixmobile.downloader.-$$Lambda$DownloadFragment$DownloadAdapter$LxyhzTeoe7ZUFXuWnasr5s63_Bc.onClick(lambda)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at android.view.View.performClick(View.java:5612)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at android.view.View$PerformClick.run(View.java:22285)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:751)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6123)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
07-30 15:21:34.465  4603  4603 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
07-30 15:21:34.476  3985  4415 E ActivityManager: Sending non-protected broadcast com.motorola.motocare.INTENT_TRIGGER from system 4660:com.motorola.process.system/1000 pkg com.motorola.motgeofencesvc
07-30 15:21:34.476  3985  4415 E ActivityManager: java.lang.Throwable
07-30 15:21:34.476  3985  4415 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:18226)
07-30 15:21:34.476  3985  4415 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:18826)
07-30 15:21:34.476  3985  4415 E ActivityManager: 	at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:512)
07-30 15:21:34.476  3985  4415 E ActivityManager: 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2906)
07-30 15:21:34.476  3985  4415 E ActivityManager: 	at android.os.Binder.execTransact(Binder.java:565)
07-30 15:21:35.002  3985  4415 E ActivityManager: Sending non-protected broadcast com.motorola.motocare.INTENT_TRIGGER from system 4660:com.motorola.process.system/1000 pkg com.motorola.motgeofencesvc
07-30 15:21:35.002  3985  4415 E ActivityManager: java.lang.Throwable
07-30 15:21:35.002  3985  4415 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:18226)
07-30 15:21:35.002  3985  4415 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:18826)
07-30 15:21:35.002  3985  4415 E ActivityManager: 	at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:512)
07-30 15:21:35.002  3985  4415 E ActivityManager: 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2906)
07-30 15:21:35.002  3985  4415 E ActivityManager: 	at android.os.Binder.execTransact(Binder.java:565)
@mgautierfr
Copy link
Member Author

I have also information coming from "Application leak" notification.

"General" information :

In org.kiwix.kiwixmobile:2.3:55.
* org.kiwix.kiwixmobile.zim_manager.ZimManageActivity has leaked:
* GC ROOT static org.kiwix.kiwixmobile.downloader.DownloadService.downloadFragment
* references org.kiwix.kiwixmobile.downloader.DownloadFragment.faActivity
* leaks org.kiwix.kiwixmobile.zim_manager.ZimManageActivity instance

* Retaining: 3,8  Ko.
* Reference Key: ce9cbb71-d6e3-4824-8877-a5ae31239edb
* Device: motorola motorola Moto G (4) athene_f
* Android Version: 7.0 API: 24 LeakCanary: 1.5.4 74837f0
* Durations: watch=5013ms, gc=166ms, heap dump=2768ms, analysis=118814ms

* Details:
* Class org.kiwix.kiwixmobile.downloader.DownloadService
| static FINISH = 3
| static ACTION_NO_WIFI = java.lang.String@717236960 (0x2ac02ae0)
| static NOTIFICATION_ID = java.lang.String@717392912 (0x2ac28c10)
| static KIWIX_TAG = java.lang.String@717329736 (0x2ac19548)
| static KIWIX_ROOT = null
| static ACTION_PAUSE = java.lang.String@1887265600 (0x707d6340)
| static CANCEL = 4
| static $classOverhead = byte[1096]@718286849 (0x2ad03001)
| static downloadFragment = org.kiwix.kiwixmobile.downloader.DownloadFragment@719091840 (0x2adc7880)
| static PLAY = 1
| static pauseLock = java.lang.Object@717251616 (0x2ac06420)
| static notifications = java.util.ArrayList@737838032 (0x2bfa83d0)
| static PAUSE = 2
| static BOOK_SIZE_OFFSET = 10.24
| static ACTION_STOP = java.lang.String@717243968 (0x2ac04640)
| static SD_CARD = null
* Instance of org.kiwix.kiwixmobile.downloader.DownloadFragment
| static mDownloads = java.util.LinkedHashMap@719180752 (0x2addd3d0)
| static $classOverhead = byte[936]@718284801 (0x2ad02801)
| static downloadAdapter = org.kiwix.kiwixmobile.downloader.DownloadFragment$DownloadAdapter@719245792 (0x2aded1e0)
| static mDownloadFiles = java.util.LinkedHashMap@737833216 (0x2bfa7100)
| faActivity = org.kiwix.kiwixmobile.zim_manager.ZimManageActivity@718246640 (0x2acf92f0)
| hasArtificiallyPaused = false
| listView = android.widget.ListView@719118336 (0x2adce000)
| mainLayout = android.support.design.widget.CoordinatorLayout@719263744 (0x2adf1800)
| relLayout = android.widget.RelativeLayout@719178752 (0x2addcc00)
| sharedPreferenceUtil = null
| zimManageActivity = org.kiwix.kiwixmobile.zim_manager.ZimManageActivity@718246640 (0x2acf92f0)
| mAdded = false
| mAnimationInfo = null
| mArguments = null
| mBackStackNesting = 0
| mCalled = true
| mCheckedForLoaderManager = false
| mChildFragmentManager = null
| mChildNonConfig = null
| mContainer = null
| mContainerId = 0
| mDeferStart = false
| mDetached = false
| mFragmentId = 0
| mFragmentManager = null
| mFromLayout = false
| mHasMenu = false
| mHidden = false
| mHiddenChanged = false
| mHost = null
| mInLayout = false
| mIndex = -1
| mInnerView = null
| mIsCreated = false
| mIsNewlyAdded = false
| mLayoutInflater = null
| mLifecycleRegistry = android.arch.lifecycle.LifecycleRegistry@719246336 (0x2aded400)
| mLoaderManager = null
| mLoadersStarted = false
| mMenuVisible = false
| mParentFragment = null
| mPerformedCreateView = false
| mPostponedAlpha = 0.0
| mRemoving = false
| mRestored = false
| mRetainInstance = false
| mRetaining = false
| mSavedFragmentState = null
| mSavedViewState = null
| mState = 0
| mTag = null
| mTarget = null
| mTargetIndex = -1
| mTargetRequestCode = 0
| mUserVisibleHint = false
| mView = null
| mWho = null
| shadow$_klass_ = org.kiwix.kiwixmobile.downloader.DownloadFragment
| shadow$_monitor_ = 0
* Instance of org.kiwix.kiwixmobile.zim_manager.ZimManageActivity
| static TAB_EXTRA = java.lang.String@717244616 (0x2ac048c8)
| static KIWIX_TAG = java.lang.String@717237280 (0x2ac02c20)
| static $classOverhead = byte[2240]@718098433 (0x2acd5001)
| languageItem = android.support.v7.view.menu.MenuItemImpl@719258456 (0x2adf0358)
| mSectionsPagerAdapter = org.kiwix.kiwixmobile.zim_manager.SectionsPagerAdapter@719181328 (0x2addd610)
| mViewPager = android.support.v4.view.ViewPager@719173632 (0x2addb800)
| searchItem = android.support.v7.view.menu.MenuItemImpl@719258336 (0x2adf02e0)
| searchQuery = java.lang.String@1885106208 (0x705c7020)
| searchView = android.support.v7.widget.SearchView@719385600 (0x2ae0f400)
| sharedPreferenceUtil = org.kiwix.kiwixmobile.utils.SharedPreferenceUtil@719152320 (0x2add64c0)
| toolbar = android.support.v7.widget.Toolbar@719381504 (0x2ae0e400)
| zimManagePresenter = org.kiwix.kiwixmobile.zim_manager.ZimManagePresenter@719579248 (0x2ae3e870)
| mDelegate = android.support.v7.app.AppCompatDelegateImplN@719167840 (0x2adda160)
| mResources = null
| mThemeId = 2131689478
| mCreated = true
| mFragments = android.support.v4.app.FragmentController@719579264 (0x2ae3e880)
| mHandler = android.support.v4.app.FragmentActivity$1@719418944 (0x2ae17640)
| mNextCandidateRequestIndex = 0
| mPendingFragmentActivityResults = android.support.v4.util.SparseArrayCompat@736951912 (0x2becfe68)
| mReallyStopped = true
| mRequestedPermissionsFromFragment = false
| mResumed = false
| mRetaining = false
| mStopped = true
| mStartedActivityFromFragment = false
| mStartedIntentSenderFromFragment = false
| mExtraDataMap = android.support.v4.util.SimpleArrayMap@736951936 (0x2becfe80)
| mLifecycleRegistry = android.arch.lifecycle.LifecycleRegistry@737615072 (0x2bf71ce0)
| mActionBar = null
| mActionModeTypeStarting = 0
| mActivityInfo = android.content.pm.ActivityInfo@735461088 (0x2bd63ee0)
| mActivityTransitionState = android.app.ActivityTransitionState@735995656 (0x2bde6708)
| mApplication = org.kiwix.kiwixmobile.KiwixApplication@717459176 (0x2ac38ee8)
| mCalled = true
| mChangeCanvasToTranslucent = false
| mChangingConfigurations = false
| mComponent = android.content.ComponentName@719579280 (0x2ae3e890)
| mConfigChangeFlags = 0
| mCurrentConfig = android.content.res.Configuration@737297360 (0x2bf243d0)
| mDecor = null
| mDefaultKeyMode = 0
| mDefaultKeySsb = null
| mDestroyed = true
| mDoReportFullyDrawn = false
| mEatKeyUpEvent = false
| mEmbeddedID = null
| mEnableDefaultActionBarUp = false
| mEnterTransitionListener = android.app.SharedElementCallback$1@1890665600 (0x70b14480)
| mExitTransitionListener = android.app.SharedElementCallback$1@1890665600 (0x70b14480)
| mFinished = true
| mFragments = android.app.FragmentController@719579296 (0x2ae3e8a0)
| mHandler = android.os.Handler@737615104 (0x2bf71d00)
| mHasCurrentPermissionsRequest = false
| mIdent = 35259481
| mInstanceTracker = android.os.StrictMode$InstanceTracker@719579312 (0x2ae3e8b0)
| mInstrumentation = android.app.Instrumentation@737485944 (0x2bf52478)
| mIntent = android.content.Intent@737543808 (0x2bf60680)
| mLastNonConfigurationInstances = null
| mMainThread = android.app.ActivityThread@717238528 (0x2ac03100)
| mManagedCursors = java.util.ArrayList@736951960 (0x2becfe98)
| mManagedDialogs = null
| mMenuInflater = null
| mParent = null
| mReferrer = java.lang.String@737543872 (0x2bf606c0)
| mResultCode = 0
| mResultData = null
| mResumed = false
| mSearchEvent = null
| mSearchManager = null
| mStartedActivity = false
| mStopped = true
| mTaskDescription = android.app.ActivityManager$TaskDescription@737615136 (0x2bf71d20)
| mTemporaryPause = false
| mTitle = java.lang.String@718073440 (0x2accee60)
| mTitleColor = 0
| mTitleReady = true
| mToken = android.os.BinderProxy@719144800 (0x2add4760)
| mTranslucentCallback = null
| mUiThread = java.lang.Thread@1959784040 (0x74cfee68)
| mVisibleBehind = false
| mVisibleFromClient = true
| mVisibleFromServer = true
| mVoiceInteractor = null
| mWindow = com.android.internal.policy.PhoneWindow@719188544 (0x2addf240)
| mWindowAdded = true
| mWindowManager = android.view.WindowManagerImpl@719165592 (0x2add9898)
| mInflater = com.android.internal.policy.PhoneLayoutInflater@719179936 (0x2addd0a0)
| mOverrideConfiguration = null
| mResources = android.content.res.Resources@719184248 (0x2adde178)
| mTheme = android.content.res.Resources$Theme@719152448 (0x2add6540)
| mThemeResource = 2131689478
| mBase = android.app.ContextImpl@719208576 (0x2ade4080)
| shadow$_klass_ = org.kiwix.kiwixmobile.zim_manager.ZimManageActivity
| shadow$_monitor_ = 1239614516
* Excluded Refs:
| Field: android.view.inputmethod.InputMethodManager.mNextServedView
| Field: android.view.inputmethod.InputMethodManager.mServedView
| Field: android.view.inputmethod.InputMethodManager.mServedInputConnection
| Field: android.view.textservice.SpellCheckerSession$1.this$0
| Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
| Thread:FinalizerWatchdogDaemon (always)
| Thread:main (always)
| Thread:LeakCanary-Heap-Dump (always)
| Class:java.lang.ref.WeakReference (always)
| Class:java.lang.ref.SoftReference (always)
| Class:java.lang.ref.PhantomReference (always)
| Class:java.lang.ref.Finalizer (always)
| Class:java.lang.ref.FinalizerReference (always)

I can also provide the head dump (hprof format, 46Mo)

@mgautierfr mgautierfr added the bug label Jul 30, 2018
@mhutti1
Copy link
Contributor

mhutti1 commented Jul 30, 2018

The crash itself we can solve easily. the issue with cleaning the notification is more tricky though as we are dead.

@kelson42
Copy link
Collaborator

I confirm the bug, the handling of the synchronisation between the downloading tab and the notification system is buggy.

@kelson42 kelson42 added this to the 2.4 milestone Jul 31, 2018
@kelson42 kelson42 modified the milestones: 2.4, 2.5 Apr 19, 2019
@macgills
Copy link
Contributor

Fixed in #1170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants