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

Exception thrown by kiwix reader. #162

Closed
mhutti1 opened this issue Jul 29, 2018 · 11 comments
Closed

Exception thrown by kiwix reader. #162

mhutti1 opened this issue Jul 29, 2018 · 11 comments
Assignees
Labels

Comments

@mhutti1
Copy link
Contributor

mhutti1 commented Jul 29, 2018

Probable cause of kiwix/kiwix-android#824

07-29 18:37:56.099  4625  6613 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
07-29 18:37:56.101  4625  6613 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6613 (Thread-13)
07-29 18:37:56.277  6689  6689 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-29 18:37:56.278  6689  6689 F DEBUG   : Build fingerprint: 'samsung/dreamltexx/dreamlte:8.0.0/R16NW/G950FXXU2CRF7:user/release-keys'
07-29 18:37:56.278  6689  6689 F DEBUG   : Revision: '10'
07-29 18:37:56.278  6689  6689 F DEBUG   : ABI: 'arm'
07-29 18:37:56.278  6689  6689 F DEBUG   : pid: 4625, tid: 6613, name: Thread-13  >>> org.kiwix.kiwixmobile <<<
07-29 18:37:56.278  6689  6689 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
07-29 18:37:56.278  6689  6689 F DEBUG   :     r0 00000000  r1 000019d5  r2 00000006  r3 00000008
07-29 18:37:56.278  6689  6689 F DEBUG   :     r4 00001211  r5 000019d5  r6 c35c7e28  r7 0000010c
07-29 18:37:56.278  6689  6689 F DEBUG   :     r8 c8eed200  r9 c91d0600  sl c35c8298  fp c35c7f2c
07-29 18:37:56.278  6689  6689 F DEBUG   :     ip 00000000  sp c35c7e18  lr f0b6e447  pc f0b9f510  cpsr 200f0010
07-29 18:37:56.304  6689  6689 F DEBUG   : 
07-29 18:37:56.304  6689  6689 F DEBUG   : backtrace:
07-29 18:37:56.304  6689  6689 F DEBUG   :     #00 pc 0004b510  /system/lib/libc.so (tgkill+12)
07-29 18:37:56.304  6689  6689 F DEBUG   :     #01 pc 0001a443  /system/lib/libc.so (abort+54)
07-29 18:37:56.304  6689  6689 F DEBUG   :     #02 pc 00fd4603  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (_ZN9__gnu_cxx27__verbose_terminate_handlerEv+230)
07-29 18:37:56.304  6689  6689 F DEBUG   :     #03 pc 00f9e481  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (_ZN10__cxxabiv111__terminateEPFvvE+4)
07-29 18:37:56.304  6689  6689 F DEBUG   :     #04 pc 00f9e589  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (_ZSt9terminatev+8)
07-29 18:37:56.304  6689  6689 F DEBUG   :     #05 pc 00f9e71b  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (__cxa_throw+110)
07-29 18:37:56.304  6689  6689 F DEBUG   :     #06 pc 009be8b8  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (_ZNK3zim10FileReader4readENS_8offset_tE+656)
07-29 18:37:56.305  6689  6689 F DEBUG   :     #07 pc 009bfbf8  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (_ZNK3zim6Reader17sub_clusterReaderENS_8offset_tENS_7zsize_tEPNS_15CompressionTypeEPb+56)
07-29 18:37:56.305  6689  6689 F DEBUG   :     #08 pc 009b0d90  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (_ZN3zim8FileImpl10getClusterENS_15cluster_index_tE+684)
07-29 18:37:56.305  6689  6689 F DEBUG   :     #09 pc 009a383c  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (_ZNK3zim7Article14getArticleSizeEv+88)
07-29 18:37:56.305  6689  6689 F DEBUG   :     #10 pc 006ef05c  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (_ZNK5kiwix5Entry7getSizeEv+68)
07-29 18:37:56.305  6689  6689 F DEBUG   :     #11 pc 007094ac  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/lib/arm/libkiwix.so (Java_org_kiwix_kiwixlib_JNIKiwixReader_getContent+412)
07-29 18:37:56.305  6689  6689 F DEBUG   :     #12 pc 00025325  /data/app/org.kiwix.kiwixmobile-wHGBUErICVNedP9hcRLJtA==/oat/arm/base.odex (offset 0x25000)

Some more details:
Seems to happen with both chunked and non chunked ZIM files. Some pages load and some don't for different users and even with different builds.

@kelson42
Copy link
Collaborator

@mgautierfr Could you please have a look to this ASAP, Android rollout is blocked (partly) because of this.

@mgautierfr
Copy link
Member

I cannot reproduce using kiwix-serve (both on native_dyn and armhf_static platform).
Tried with wikem_en_all_2018-07.zim, wiktionary_en_all_novid_2018-06.zim.

Is it possible to have more information ?

  • What are used versions of kiwix-lib and libzim ?
  • How they have been compiled ? (kiwix-build ? other ?)
  • What was the zim used and the url of the article when KiwixReader::getContent has thrown an exception ?

BTW, even if we should investigate why we throw an exception and fix this, the exception is thrown if
the low level read function fails. It can be because of bug on our code and invalid arguments (probably the case here) or it can be from anything else (hardware error from a dying sdcard, ...).
The exception should be catch and handled properly in the kiwix-android code to correctly display to the user that something went wrong (and also provide a way to report bug with backtrace)

@mhutti1
Copy link
Contributor Author

mhutti1 commented Jul 30, 2018

kiwix-lib version is master. libzim should be too.
Compiled with kiwix-build.
ZIM file is any but mainly occurs with large ZIM files such as German or English full Wikipedia.
30GB + files.

We are catching this and not crashing. But this is occurring with in some cases over half the articles in the ZIM files so we can't display the majority of our content to some users. This is not a hardware issue as it is too prevalent with many users reporting it as a recent regression.

@kelson42
Copy link
Collaborator

I really suspect that something is wrong with how we handle cluster > 4GB. I have tried many files >4GB but with an ft index <4GB on my Android phone (with and without chunks) and they all work fine. The problems start with really big files (with I suspect a ft index > 4GB). That said, kiwix-serve on x64_64 works perfectly.... so we have here something a bit more subtle, maybe related to the ARM architecture. What I would suggest here @mgautierfr is to build lowlevel debugging to be able to trace variable values at the read() level before it crash.

@mgautierfr
Copy link
Member

What I would suggest here @mgautierfr is to build lowlevel debugging to be able to trace variable values at the read() level before it crash.

I've added a lot of information in the thrown exception. (openzim/libzim#176 and #163).

@kelson42
Copy link
Collaborator

@mgautierfr Thx you very much for the quick help
@mhutti1 All of this is merged, could you give a try again and share the log here again?

@mgautierfr
Copy link
Member

With kiwix-android build on my own, I've succed to have some information while try to opening wikipedia_en_all_novid_2018-06.zim.
The error is "Cannot mmap : Out of memory"

It confirms the behavior (sporadic bug, more frequent with big zim file).
I'm investigating, but it could lead to bigger changes in libzim that just a "simple fix".

@kelson42
Copy link
Collaborator

@mgautierfr Ouch, this stinks...

@kelson42
Copy link
Collaborator

@mhutti1
Copy link
Contributor Author

mhutti1 commented Jul 31, 2018 via email

@mgautierfr
Copy link
Member

Last changes (mainly openzim/libzim#178) should fix the problem.

I can now open wikipedia_en_all on my android phone without any problem.
Last nightly (http://download.kiwix.org/nightly/2018-08-01/) integrates these changes.

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

3 participants