SufficientlySecure/document-viewer

Crashes; Oreo 8.1, MuPDF related (crashes aswell)

Closed this issue · 10 comments

Tested versions 2.7.9 (armeabi-v7a and arm64-v8a) to 2.8.1 (arm64-v8a).
Application works normally when opening PDF documents via system file explorer. However, if I press the upper left back button to go to file explorer the app can crash, no matter if in bookcase or list view.
If I open the app via app drawer I can access configuration menu and etc. Once I open a document there in its file explorer and switch to another task via recents the app can crash.
If I open a PDF file via system file exporer app behaves normally until I start switching tasks via recents, then it can crash.
When I mean crash, I mean I get a system popup window which tells me “Document Viewer has stopped”.
I have “Show all ANRs” (show App Not Responding dialog for background apps) enabled in developer options.
Briefly tried MuPDF, crashing behaviour too. MuPDF and this app seem to share code.

Cheers :-)

I've got crashes too, running Samsung Android 8 on Galaxy S7 Intl: the document is shown perfectly, a while after I close it I get the message "Stopped working" which means it crashed. I think it's possibly a leak somewhere, if I find the time I will try to get a logcat

Same problem here, Android 8.1 on Motorola Moto G5 Plus.

ildar commented

Reproduce the crash? Just use the app LoL! It just crashes. Notice all of us reporting crashes are running Android 8.1 (AEX5.7 Zuk Z2 Pro here). Workaround for me is to open and close window before opening another document, either this or crash.
I would also like to know… why is this application limited to running single instance? Being able to examine multiple files concurrently is a handy useful thing. Same old story I guess, lots of nowadays' software is so retardedly limited on purpose that if I were to dare to write an essay in that regard I doubt I'd ever end LoL.

Cheers fellows :-)

Getting error while trying to open pdf. and app is crashing.

E/Document Viewer.LibraryLoader: Native library cannot be loaded:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/base.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_dependencies_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_resources_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_0_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_1_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_2_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_3_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_4_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_5_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_6_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_7_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_8_apk.apk", zip file "/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/org.sufficientlysecure.viewer-7NkFQRwEtM88AHWoeM8tOA==/lib/arm64, /system/lib64, /system/vendor/lib64]]] couldn't find "libebookdroid.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
at java.lang.System.loadLibrary(System.java:1657)
at org.ebookdroid.EBookDroidLibraryLoader.load(EBookDroidLibraryLoader.java:17)
at org.ebookdroid.droids.mupdf.codec.MuPdfContext.(MuPdfContext.java:24)
at java.lang.Class.newInstance(Native Method)
at org.ebookdroid.core.models.DocumentModel.(DocumentModel.java:71)
at org.ebookdroid.ui.viewer.ViewerActivityController.afterCreate(ViewerActivityController.java:242)
at org.ebookdroid.ui.viewer.ViewerActivityController.afterCreate(ViewerActivityController.java:98)
at org.emdev.ui.AbstractActionActivity.onCreate(AbstractActionActivity.java:108)

Any one tell me how to resolve this error.

@Barkuti
@fabmazz
@steve95

I think I have found a solution:
Try the following in the settings of the app and it will solve the issue of crashes on Android 10 emulator:
Performance settings -> Pages in Memory -> anything other than the default 0 (tested 1,4,16 all working fine)

Can you confirm that this solves the crash issue for you as well? I think Android 8,9,10 are affected, but now with this simple change, it works without any crashes...

Thanks for pinpointing hwasiti. Got another crash briefly after changing the Pages in Memory setting but its running normally now.
I must admit long ago I also thought about trying to change some setting which could fix the problem and even tried a couple things, but decided to wait for some input from the software creator (which should know better).
Dominik Schürmann needs to know.

Thanks a lot. :-)

Glad it helped. I will do a pull request for the changes. And hopefully the developers will release newer version to playstore with different default value to correct the issue for everybody. It seems from my glance on playstore reviews today, there are a lot of bad reviews in 2018-2019 due to this crash. Before that in 2016 and 2017, average reviews were much better.

I experienced crashes of 2.8.1 on Android 9 (Lineage). After swithing document viewer to background by opening another application it took some seconds until the os reported that d.v. was crashed. I found a workaround by switching battery optimization (I do not know whether this is the correct translation of the German menu item) off for document viewer. I hope this will not result in high energy consumption.

@hwasiti Thanks for the Pages in Memory setting. Seemingly this fixes the problem temporarily. I succeeded in catching a log before a crash with backtrace:
docviewer.txt

If I understand correctly, the call stack looks like
https://github.com/SufficientlySecure/document-viewer/blob/master/document-viewer/src/main/java/org/ebookdroid/droids/mupdf/codec/MuPdfPage.java
(methods) finalize() -> recycle() -> free()
the method free() is defined in the C code


which calls the C function fz_drop_display_list() in which a call to fz_defer_reap_start() was invoked. However, the latest code in MuPDF
https://git.ghostscript.com/?p=mupdf.git;a=blob;f=fitz/dev_list.c;hb=f85653219a85a9f91cb14471485611ca5f6b25ba#l628
does not contain a call to fz_defer_reap_start(). The function is not found in the current code of MuPDF.