-
-
Notifications
You must be signed in to change notification settings - Fork 462
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
Fixed: Version 3.9.1
was experiencing occasional crashes when setting the SuggestionSearcher
.
#3649
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3649 +/- ##
============================================
- Coverage 51.70% 51.69% -0.02%
- Complexity 1241 1242 +1
============================================
Files 288 288
Lines 10841 10851 +10
Branches 1451 1454 +3
============================================
+ Hits 5605 5609 +4
- Misses 4282 4289 +7
+ Partials 954 953 -1 ☔ View full report in Codecov by Sentry. |
@MohitMaliFtechiz You seems to imply that the root cause of these crash is in libkiwix but you propose a patch in Kiwix. To me this seems incoherent. What is the precise and exact root cause of these crash scenarios? |
@kelson42, There are a few occurrences detected by playstore, this error is happening on the Play Store which has limited access to storage. We are experiencing the same issue with the same logs in #3636. Here in Play Store variant, since there are a few occurrences, it might be possible only a few users are using this feature of our application. When there is a permission-related issue So to address this problem we have improved the exception handling on the Android side, and improved our |
@MohitMaliFtechiz I think the root problem is not well understand so far and I have therefore concern to merge a PR which might simply hide the issue. |
@kelson42 I think @MohitMaliFtechiz can't produce this bug and based on the log the playstore provided @MohitMaliFtechiz is trying to solve them. Both this and #3636 might solve this problem. If there's no error in the playstore in the future we'll guess it solved. @MohitMaliFtechiz am i right? |
@gouri-panda Your explanation is quite right here. I want to add one point here, This error happens when the |
3575221
to
658a2a5
Compare
@gouri-panda, I have added the check on |
@MohitMaliFtechiz Thanks! I'll look into that. |
#3636 is about opening ZIM files via filehandler. This should not happen in Kiwix (only in custom apps). So what is the root cause of the crashes we have here? |
Are you sure the title suggestions work in this scenario?!? because our investigation with @mgautierfr then to show that it's impossible from it on armv8 to open properly a new filehandler for the Xapian |
@kelson42 all functionalities are working fine in the non-playstore variant including suggestions search. However, in play store variant, it is showing the kiwix-android/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt Line 304 in 3f19f55
I got a new pixel 2 device today, and I have tested this scenario with that device and I can reproduce the bug on that device with the same logs. *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A Build fingerprint: 'google/lynx/lynx:14/UQ1A.231205.015/11084887:user/release-keys'
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A Revision: 'MP1.0'
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A ABI: 'arm64'
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A Timestamp: 2024-01-15 15:03:48.266380955+0530
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A Process uptime: 18s
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A Cmdline: org.kiwix.kiwixmobile
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A pid: 32558, tid: 32558, name: wix.kiwixmobile >>> org.kiwix.kiwixmobile <<<
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A uid: 10372
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000000
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A Cause: null pointer dereference
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A x0 0000000000000000 x1 000000005c000000 x2 b40000727b87d380 x3 000000000000004a
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A x4 000000000000004a x5 656c646e61486576 x6 656c646e61486576 x7 00000071ba4a8ff4
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A x8 0c19bb479d82c700 x9 0c19bb479d82c700 x10 00000071bae03620 x11 0000007fc2bd4100
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A x12 0000000000000001 x13 000000712c8e6cd4 x14 00000000000000a3 x15 0000007466c42a70
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A x16 0000000000000001 x17 000000745f8e4900 x18 00000074661d6000 x19 b40000739b878530
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A x20 0000007fc2bd437c x21 0000007fc2bd4378 x22 000000712caf3c62 x23 0000000000002070
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A x24 00000071ba9b0c80 x25 0000007fc2bd4390 x26 0000007fc2bd43a8 x27 0000007fc2bd4390
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A x28 0000007fc2bd4290 x29 0000007fc2bd4270
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A lr 00000071b5f2f464 sp 0000007fc2bd4230 pc 00000071b5f2f464 pst 0000000060001000
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A 46 total frames
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A backtrace:
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A #00 pc 0000000000025464 /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/base.apk!libzim_wrapper.so (offset 0x119e000) (Java_org_kiwix_libzim_SuggestionSearcher_setNativeSearcher+112) (BuildId: 6c0d6ee977af86c7d817e067ec4176543043faa4)
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A #01 pc 0000000000355830 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.403 374-374 DEBUG pid-374 A #02 pc 00000000005ba6b0 /apex/com.android.art/lib64/libart.so (nterp_helper+4016) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #03 pc 0000000000242c62 /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.libzim.SuggestionSearcher.<init>+6)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #04 pc 00000000005ba654 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #05 pc 00000000002200fa /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.kiwixmobile.core.reader.ZimFileReader.<init>+34)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #06 pc 00000000005bad58 /apex/com.android.art/lib64/libart.so (nterp_helper+5720) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #07 pc 000000000021fad4 /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.kiwixmobile.core.reader.ZimFileReader$Factory$Impl.create+72)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #08 pc 00000000005bb474 /apex/com.android.art/lib64/libart.so (nterp_helper+7540) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #09 pc 0000000000214508 /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.kiwixmobile.core.main.CoreReaderFragment.openAndSetInContainer$default+176)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #10 pc 00000000005b9734 /apex/com.android.art/lib64/libart.so (nterp_helper+52) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #11 pc 000000000021485a /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.kiwixmobile.core.main.CoreReaderFragment.openZimFile$default+114)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #12 pc 00000000005b9734 /apex/com.android.art/lib64/libart.so (nterp_helper+52) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #13 pc 000000000023c5e2 /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.kiwixmobile.nav.destination.reader.KiwixReaderFragment.onNewIntent$enumunboxing$+166)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #14 pc 00000000005bb474 /apex/com.android.art/lib64/libart.so (nterp_helper+7540) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #15 pc 0000000000217fbe /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.kiwixmobile.core.main.NavigationHostFragment.onNewIntent$enumunboxing$+134)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #16 pc 00000000005bb474 /apex/com.android.art/lib64/libart.so (nterp_helper+7540) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #17 pc 0000000000210650 /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.kiwixmobile.core.main.CoreMainActivity.onNewIntent+132)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #18 pc 00000000005ba654 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #19 pc 000000000023843a /data/app/~~47c46jMWHkPfuKlhZIWq7A==/org.kiwix.kiwixmobile-QcJwRLIuFEQJJcKwmYHhGw==/oat/arm64/base.vdex (org.kiwix.kiwixmobile.main.KiwixMainActivity.onNewIntent+10)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #20 pc 0000000000632ffc /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.Instrumentation.callActivityOnNewIntent+156)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #21 pc 0000000000633124 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.Instrumentation.callActivityOnNewIntent+180)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #22 pc 00000000006ffc7c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.deliverNewIntents+396)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #23 pc 000000000071c548 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.handleNewIntent+312)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #24 pc 00000000008df4a0 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.servertransaction.NewIntentItem.execute+144)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #25 pc 00000000008caf1c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.servertransaction.ActivityTransactionItem.execute+92)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #26 pc 000000000066716c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.servertransaction.TransactionExecutor.executeCallbacks+572)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #27 pc 0000000000666ec4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.servertransaction.TransactionExecutor.execute+708)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #28 pc 00000000006fae68 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread$H.handleMessage+1464)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #29 pc 000000000096d298 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Handler.dispatchMessage+152)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #30 pc 0000000000970be4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loopOnce+980)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #31 pc 0000000000970774 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loop+916)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #32 pc 00000000007127dc /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.main+2028)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #33 pc 000000000033f080 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #34 pc 00000000003884dc /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1588) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #35 pc 0000000000387e98 /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+32) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #36 pc 000000000031b038 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+120)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #37 pc 0000000000b60bb4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+116)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #38 pc 0000000000b6b738 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.ZygoteInit.main+3208)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #39 pc 000000000033f080 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #40 pc 00000000004e1ea8 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+728) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #41 pc 000000000057b930 /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+156) (BuildId: 735f12f804f88d62a2cb437261076ff7)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #42 pc 00000000000daca8 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+104) (BuildId: 04347e608daaf447fe7dabf331c4ff21)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #43 pc 00000000000e6e2c /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+860) (BuildId: 04347e608daaf447fe7dabf331c4ff21)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #44 pc 000000000000254c /system/bin/app_process64 (main+1260) (BuildId: e8762c072e6c37bb8093e340cc42e9f2)
2024-01-15 15:03:48.404 374-374 DEBUG pid-374 A #45 pc 00000000000546e8 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+104) (BuildId: 19c32900d9d702c303d2b4164fbba76c) This PR resolved this crash and shows the |
@MohitMaliFtechiz What you say here is in contradiction with what you say at #3636 where we fail there to open the Xapian index if ZIM file is open via fd even on a non playstore version. Please clarify. |
@MohitMaliFtechiz OK, but here we are trying to fix a problem on the PS version, so we should not use fd as this is simply not working! We should rewrite the code to stop to do - or stop allowing to do so - so for PS version. |
@kelson42 In playstore variant we also have the limitation on accessing files from the fileSystem by using this feature. This PR validates the fd before passing it to the libkiwix whether it can open or not in libkiwix. Are you pointing to disabling this feature in the Play Store variant? |
@MohitMaliFtechiz You should perfectly know already if a file can be open or not and how. You should not wait an error at the libkiwix level and treat it. The libkiwix does not trigger any random error. Please secure you use procedures which work properly. Otherwise open a bug in |
@kelson42 I understand your concern, I also try to make sure every feature works fine on every device, and for that, I test all functionality on different devices with different architectures.
Most of the things are clear now after a conversation with @mgautierfr in #3628 and in this PR I am using the same way for validating the fd before opening the ZIM file in libkiwix to avoid this type of crash, and yes libkiwix is triggering the genuine error as libkiwix using the path to open fd for properly work with xapian. But for the PS variant, we can not do it.
Yes, I understand how these functions are working they both need access to the file path to properly work with the Xapian and in the PS version we have this limitation that is why we are encountering this type of problem. But now we are not waiting for libkiwix error we are handling them on our end.
Sorry for not opening the issue on the libkiwix repo I only ask @mgautierfr for the might possible solution for open Xapain without filepath in #3628, but now I opened a ticket in libzim for it openzim/libzim#852. |
Don't open a file via fd if this will generate an exception, this is what your fix should do. Not catching an exception. |
@kelson42 Let me explain what is going on in PS version. In the PS version there is no way to open the ZIM file when a user tries to open this by just clicking on it, since we do not have permission to access that ZIM file via its path, whether we can open it via filePath or fileDescriptor both will throw permission denied exception. However, in the non PS version, there is no error while reading this by filePath or fileDescriptor we have the necessary permission for both.
For this reason, I thought you asking for disabling the feature. But you were not pointing to this, so for this, we have to catch the exception as we can not open the ZIM file via both let me know if anything is still unclear about this fix. |
@kelson42 Are you ok with the current solution? Then I can move on with the review. |
No! Confusing exception mgmt with error mgmt is NOK. code should be adapted to avoid triggering this exception. Its trivial to do one way for PS version and another way for non PS version if this is necessary for the user get the best UX. |
d3feb43
to
01e23cf
Compare
@kelson42, @gouri-panda I have made the changes in the code according to your request. |
@MohitMaliDeveloper Thanks! sorry for being late in this thread! I'll look into that. |
01e23cf
to
d5cc569
Compare
…SuggestionSearcher. * The crashes occurred in the Play Store version due to insufficient permissions for opening a file via `fileDescriptor`. To address this issue, we have modified the implementation to use the `file` instead of `fileDescriptor`. This adjustment ensures smooth operation in the non-Play Store version where we have permission to open a file via its path. In the Play Store version, it will display a proper error message to the user, preventing errors thrown by libkiwix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kelson42 LGTM!
private fun getZimFileFromUri( | ||
uri: Uri | ||
): File? { | ||
val filePath = FileUtils.getLocalFilePathByUri( | ||
requireActivity().applicationContext, uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MohitMaliDeveloper we should add tests for this. Maybe in a new PR. This PR is too old now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MohitMaliDeveloper In such case, please update immediatly a new issue, I think this has not been done.
Fixes #3643
The crashes occurred in the Play Store version due to insufficient permissions for opening a file via
fileDescriptor
. To address this issue, we have modified the implementation to use thefile
instead offileDescriptor
. This adjustment ensures smooth operation in the non-Play Store version where we have permission to open a file via its path. In the Play Store version, it will display a proper error message to the user, preventing errors thrown by libkiwix.