kiwix / kiwix-android

Kiwix for Android
https://android.kiwix.org
GNU General Public License v3.0
868 stars 443 forks source link

org.kiwix.kiwixmobile.core.reader.ZimReaderContainer.setZimFile Input dispatching timed out #3929

Open kelson42 opened 3 months ago

kelson42 commented 3 months ago

image

CalebKL commented 2 months ago

Let me work on this issue

MohitMaliFtechiz commented 2 months ago

@CalebKL These are the full logs of the crash.

  at jdk.internal.misc.Unsafe.park (Native method)
  at java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:252)
  at kotlinx.coroutines.BlockingCoroutine.joinBlocking (BlockingCoroutine.java:88)
  at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking (BuildersKt__Builders.kt:59)
  at kotlinx.coroutines.BuildersKt.runBlocking (Builders.kt:1)
  at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default (BuildersKt__Builders.kt:38)
  at kotlinx.coroutines.BuildersKt.runBlocking$default (Builders.kt:1)
  at org.kiwix.kiwixmobile.core.reader.ZimReaderContainer.setZimFile (ZimReaderContainer.kt:42)
  at org.kiwix.kiwixmobile.core.main.CoreReaderFragment.openAndSetInContainer (CoreReaderFragment.kt:1622)
  at org.kiwix.kiwixmobile.core.main.CoreReaderFragment.openAndSetInContainer$default (CoreReaderFragment.kt:1603)
  at org.kiwix.kiwixmobile.core.main.CoreReaderFragment.openZimFile (CoreReaderFragment.kt:1565)
  at org.kiwix.kiwixmobile.core.main.CoreReaderFragment.openZimFile$default (CoreReaderFragment.kt:1554)
  at org.kiwix.kiwixmobile.nav.destination.reader.KiwixReaderFragment.tryOpeningZimFile (KiwixReaderFragment.kt:125)
  at org.kiwix.kiwixmobile.nav.destination.reader.KiwixReaderFragment.openPageInBookFromNavigationArguments (KiwixReaderFragment.kt:102)
  at org.kiwix.kiwixmobile.nav.destination.reader.KiwixReaderFragment.onViewCreated (KiwixReaderFragment.kt:83)
  at androidx.fragment.app.Fragment.performViewCreated (Fragment.java:3128)
  at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:552)
  at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:261)
  at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:1899)
  at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:1823)
  at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1760)
  at androidx.fragment.app.FragmentManager$5.run (FragmentManager.java:547)
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:257)
  at android.os.Looper.loop (Looper.java:368)
  at android.app.ActivityThread.main (ActivityThread.java:8848)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:572)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1049)
CalebKL commented 2 months ago

@kelson42 The ANR on this issue is being caused by runblocking which is blocking the main thread and hence causing the crash. We have a discussion with @MohitMaliFtechiz on how to fix the bug but it involves a couple of changes and might also involve a bit of changes to the UI. I wanted to put this down so you could know on the changes that would result in fixing this issue.

kelson42 commented 2 months ago

@CalebKL Thank you for keeping us informed. Would you be able to wrapup here the few changes you have in mind? One assessed by @MohitMaliDeveloper you could move forward. It's one of the last issue of the current milestone.

CalebKL commented 2 months ago

We would change the CustomReaderFragment and maybe have a progress bar to show the user when they are waiting for the article to load. I will work on the PR as soon as possible and send for review.

kelson42 commented 2 months ago

@MohitMaliFtechiz What do you think? I don't remember us to remove the article loading progressbar?

MohitMaliFtechiz commented 2 months ago

@CalebKL We have to show the progress in CoreReaderFramgment not in CustomReaderFagment. CoreReaderFragment is the base class for both KiwixReaderFragment and CustomReaderFragment. So we have to show the progress there when the zimFIleReader creation is in progress until the creation is not completed so that user can know about what is going on.

@MohitMaliFtechiz What do you think? I don't remember us to remove the article loading progressbar?

No, we have not removed the article loading progresBar.

CalebKL commented 2 months ago

@CalebKL We have to show the progress in CoreReaderFramgment not in CustomReaderFagment. CoreReaderFragment is the base class for both KiwixReaderFragment and CustomReaderFragment. So we have to show the progress there when the zimFIleReader creation is in progress until the creation is not completed so that user can know about what is going on.

@MohitMaliFtechiz What do you think? I don't remember us to remove the article loading progressbar?

No, we have not removed the article loading progresBar.

Okay got it.