espresso3389 / pdfrx

pdfrx is yet another PDF viewer implementation that built on the top of pdfium. The plugin currently supports Android, iOS, Windows, macOS, Linux, and Web.
MIT License
60 stars 36 forks source link

Android Crash shaders/ink_sparkle.frag #139

Closed ThomasAunvik closed 3 weeks ago

ThomasAunvik commented 3 weeks ago

This might be an issue with flutter itself https://github.com/flutter/flutter/issues/143806 , reported to this repo since this plugin has that issue when i used it.

Tested with and without impeller.

Also tested on the master branch of flutter, same issue.

Crash Message (On 3.19.6) ``` I/flutter (25138): Exception: Asset 'shaders/ink_sparkle.frag' does not contain appropriate runtime stage data for current backend (Vulkan). I/flutter (25138): Found stages: SkSL OpenGLES I/flutter (25138): #0 new FragmentProgram._fromAsset (dart:ui/painting.dart:4446:7) I/flutter (25138): #1 FragmentProgram.fromAsset. (dart:ui/painting.dart:4473:55) I/flutter (25138): #2 new Future.microtask. (dart:async/future.dart:280:37) I/flutter (25138): #3 _rootRun (dart:async/zone.dart:1391:47) I/flutter (25138): #4 _CustomZone.run (dart:async/zone.dart:1301:19) I/flutter (25138): #5 _CustomZone.runGuarded (dart:async/zone.dart:1209:7) I/flutter (25138): #6 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1249:23) I/flutter (25138): #7 _rootRun (dart:async/zone.dart:1399:13) I/flutter (25138): #8 _CustomZone.run (dart:async/zone.dart:1301:19) I/flutter (25138): #9 _CustomZone.runGuarded (dart:async/zone.dart:1209:7) I/flutter (25138): #10 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1249:23) I/flutter (25138): #11 _microtaskLoop (dart:async/schedule_microtask.dart:40:21) I/flutter (25138): #12 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5) I/ViewRootImpl@1cc2451[MainActivity](25138): ViewPostIme pointer 1 I/ViewRootImpl@1cc2451[MainActivity](25138): ViewPostIme pointer 0 I/ViewRootImpl@1cc2451[MainActivity](25138): ViewPostIme pointer 1 W/WindowOnBackDispatcher(25138): OnBackInvokedCallback is not enabled for the application. W/WindowOnBackDispatcher(25138): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest. I/ViewRootImpl@1cc2451[MainActivity](25138): ViewPostIme pointer 0 I/ViewRootImpl@1cc2451[MainActivity](25138): ViewPostIme pointer 1 W/WindowOnBackDispatcher(25138): OnBackInvokedCallback is not enabled for the application. W/WindowOnBackDispatcher(25138): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest. F/libc (25138): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xaaaaaaaaaaaaaac4 in tid 26290 (DartWorker), pid 25138 (elematics.debug) *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'samsung/dm2qxeea/dm2q:14/UP1A.231005.007/S916BXXS3CXD2:user/release-keys' Revision: '13' ABI: 'arm64' Processor: '5' Timestamp: 2024-04-22 16:19:28.216591704+0200 Process uptime: 17s Cmdline: app.debug pid: 25138, tid: 26290, name: DartWorker >>> app.debug <<< uid: 10437 tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE) pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY) signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xaaaaaaaaaaaaaac4 x0 aaaaaaaaaaaaaaaa x1 0000000000000003 x2 0000006e54ce76d0 x3 00000000013a0000 x4 0000000000c80000 x5 0000000000000000 x6 0000006e54ce7770 x7 0000006e54cedd1c x8 00000000000000aa x9 0000000000000000 x10 0000006e54ce76a0 x11 0000006e54ceda58 x12 0000006e54ceda58 x13 0000006e54ceda68 x14 0000000000004998 x15 0000006e54ced0c0 x16 0000006e3c7105c8 x17 0000006e3c5e9e38 x18 0000006e3bfe6000 x19 0000006e81eeede0 x20 0000006e54ce76a0 x21 00000002000e52b0 x22 0000000000000000 x23 0000006e54ce76d0 x24 0000000000000001 x25 0000000000000000 x26 0000000000000000 x27 0000006e54ce7760 x28 0000006e54ce90d0 x29 0000006e54ce7620 lr 0000006e3c5ff8ec sp 0000006e54ce7620 pc 0000006e3c5ffaa8 pst 0000000060001000 22 total frames backtrace: #00 pc 0000000000332aa8 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #01 pc 00000000003328e8 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #02 pc 0000000000337198 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #03 pc 0000000000335b64 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #04 pc 00000000003335e4 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #05 pc 00000000003302fc /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #06 pc 00000000003290e0 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #07 pc 000000000031ca00 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (FT_Load_Glyph+684) (BuildId: 31d267ee9094669e) #08 pc 00000000003ad5d0 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #09 pc 00000000003add20 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #10 pc 00000000002679c0 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #11 pc 0000000000268044 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #12 pc 0000000000263fc4 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #13 pc 0000000000260814 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #14 pc 00000000002622c4 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #15 pc 00000000002645a4 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #16 pc 0000000000244804 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #17 pc 000000000024436c /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #18 pc 0000000000259580 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #19 pc 0000000000256238 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (BuildId: 31d267ee9094669e) #20 pc 00000000003138a8 /data/app/~~D1xikDs1QFM--a59MrXzAQ==/app.debug-xqsXeRiqWJGsHOg58BmXdw==/base.apk!libpdfium.so (offset 0x55ed000) (FPDF_LoadPage+116) (BuildId: 31d267ee9094669e) #21 pc 0000000000007bc4 [anon:dart-code] Lost connection to device. ``` Flutter Doctor ``` [✓] Flutter (Channel stable, 3.19.6, on Arch Linux 6.8.7-zen1-1-zen, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✗] Linux toolchain - develop for Linux desktop ✗ clang++ is required for Linux development. It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/ ✗ ninja is required for Linux development. It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases [✓] Android Studio (version 2023.2) [✓] Connected device (2 available) [✓] Network resources ```
Crash Message (master, 3.22.0-14.0.pre.67) ``` F/libc (17084): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x80ef050002000004 in tid 18508 (DartWorker), pid 17084 (elematics.debug) *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'samsung/dm2qxeea/dm2q:14/UP1A.231005.007/S916BXXS3CXD2:user/release-keys' Revision: '13' ABI: 'arm64' Processor: '5' Timestamp: 2024-04-22 16:58:28.149952739+0200 Process uptime: 58s Cmdline: app.debug pid: 17084, tid: 18508, name: DartWorker >>> app.debug <<< uid: 10437 tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE) pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY) signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x80ef050002000004 x0 000000020005efc0 x1 000000020005efc0 x2 0000006e4b2df800 x3 0043505520696d70 x4 0000000000000080 x5 0000000000000000 x6 8000000000000000 x7 0073697365736569 x8 80ef050002000000 x9 8e548581286157a3 x10 0000000000000000 x11 000000000000017e x12 0000000000000073 x13 0000006e4af5d64d x14 00000000ffffffe9 x15 000000000000001d x16 0000000000000001 x17 0000006e4b0b3bb8 x18 0000006fd4376000 x19 000000020005efc0 x20 0000000000000000 x21 0000000000000000 x22 0000000000001910 x23 0000000000000063 x24 0000006e4aed890c x25 aaaaaaaaaaaaaaaa x26 b400006e99f69200 x27 0000006d0b3323d0 x28 000000080000006d x29 0000006fdbb749e0 lr 0000006e4b23501c sp 0000006fdbb749e0 pc 0000006e4b0b3d10 pst 0000000000001000 16 total frames backtrace: #00 pc 000000000022cd10 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #01 pc 00000000003ae018 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #02 pc 00000000003ade68 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #03 pc 00000000003aff28 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #04 pc 00000000003ab374 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #05 pc 0000000000249fac /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #06 pc 0000000000263d3c /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #07 pc 0000000000260784 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #08 pc 00000000002622c4 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #09 pc 00000000002645a4 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #10 pc 0000000000244804 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #11 pc 000000000024436c /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #12 pc 0000000000259580 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #13 pc 0000000000256238 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (BuildId: 31d267ee9094669e) #14 pc 00000000003138a8 /data/app/~~KVdD_wv8cdXqtefVQwP5BA==/app.debug-XWX2cgUnhmnB9fotlw_8pw==/base.apk!libpdfium.so (offset 0x4b26000) (FPDF_LoadPage+116) (BuildId: 31d267ee9094669e) #15 pc 0000000000007f84 [anon:dart-code] Lost connection to device. ``` Flutter Doctor: ``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel master, 3.22.0-14.0.pre.67, on Arch Linux 6.8.7-zen1-1-zen, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✗] Linux toolchain - develop for Linux desktop ✗ clang++ is required for Linux development. It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/ ✗ ninja is required for Linux development. It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases [✓] Android Studio (version 2023.2) [✓] Connected device (2 available) [✓] Network resources ```
ThomasAunvik commented 3 weeks ago

So, I now tested with the master branch a bit further, and added some prints between FPDF_LoadPage calls.

https://github.com/espresso3389/pdfrx/blob/5717726e31dbfcaee7bba0d332c260ab62d7a095/lib/src/pdfium/pdfrx_pdfium.dart#L358-L362

I don't know if its just the pdf files i have, the way i load them or etc. I use PdfViewer.data() , to show the pdf files.

I tested this first on pdfium chromium/6259 (which is what currently is on master), and tested it also with the latest version chromium/6406

In one instance I believe, it failed to render due to an invalid glyph? And then i tried using an almost empty pdf.

And sometimes it would be able to render a few pages in a short second, and then crashes.

Maybe one suggests it could be a concurrency issue? Idk if that is what is used in this project? https://stackoverflow.com/a/64653357

Almost Empty PDF (chromium/6259) ``` 2024-04-23 13:14:36.854 8259-9053 libc app.debug A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xec050002000004 in tid 9053 (DartWorker), pid 8259 (elematics.debug) 2024-04-23 13:14:37.087 2007-2007 LayerHistory surfaceflinger I SurfaceView[app.debug/app.MainActivity]@0(BLAST)#88589 Max (can't resolve refresh rate) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A Cmdline: app.debug 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A pid: 8259, tid: 9053, name: DartWorker >>> app.debug <<< 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #00 pc 000000000022cd10 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #01 pc 00000000003b01a0 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #02 pc 00000000003ade58 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #03 pc 00000000003aff28 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #04 pc 00000000003ab374 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #05 pc 0000000000249fac /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #06 pc 0000000000263d3c /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #07 pc 0000000000260784 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #08 pc 00000000002622c4 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #09 pc 00000000002645a4 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #10 pc 0000000000244804 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #11 pc 000000000024436c /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #12 pc 0000000000259580 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #13 pc 0000000000256238 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 31d267ee9094669e) 2024-04-23 13:14:37.635 9064-9064 DEBUG crash_dump64 A #14 pc 00000000003138a8 /data/app/~~AcPHYsjICy41PY86raVCuw==/app.debug-Dk0XqMtv4rBHXZam8jYFIA==/base.apk!libpdfium.so (offset 0x4b2b000) (FPDF_LoadPage+116) (BuildId: 31d267ee9094669e) ```
Almost Empty PDF (chromium/6406) ``` 2024-04-23 13:09:04.297 25036-27768 libc app.debug A Fatal signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x6e96604ece in tid 27768 (DartWorker), pid 25036 (app.debug) 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A Cmdline: app.debug 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A pid: 25036, tid: 27768, name: DartWorker >>> app.debug <<< 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A #00 pc 0000000000048ece /data/app/~~PqQQMhWydwu8-hjjW7bcXw==/app.debug-n2Jf17X6iTV8AhWlRgfRNw==/base.apk (offset 0x3ddd000) 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A #01 pc 000000000023230c /data/app/~~PqQQMhWydwu8-hjjW7bcXw==/app.debug-n2Jf17X6iTV8AhWlRgfRNw==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A #02 pc 0000000000230fd0 /data/app/~~PqQQMhWydwu8-hjjW7bcXw==/app.debug-n2Jf17X6iTV8AhWlRgfRNw==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A #03 pc 0000000000234f24 /data/app/~~PqQQMhWydwu8-hjjW7bcXw==/app.debug-n2Jf17X6iTV8AhWlRgfRNw==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A #04 pc 00000000002377c4 /data/app/~~PqQQMhWydwu8-hjjW7bcXw==/app.debug-n2Jf17X6iTV8AhWlRgfRNw==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A #05 pc 00000000002371f8 /data/app/~~PqQQMhWydwu8-hjjW7bcXw==/app.debug-n2Jf17X6iTV8AhWlRgfRNw==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A #06 pc 0000000000250078 /data/app/~~PqQQMhWydwu8-hjjW7bcXw==/app.debug-n2Jf17X6iTV8AhWlRgfRNw==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:09:05.687 27975-27975 DEBUG crash_dump64 A #07 pc 0000000000330278 /data/app/~~PqQQMhWydwu8-hjjW7bcXw==/app.debug-n2Jf17X6iTV8AhWlRgfRNw==/base.apk!libpdfium.so (offset 0x4b2b000) (FPDF_LoadPage+168) (BuildId: 40e72f97fa135049) ```
Page with Invalid Glyph PDF (chromium/6406) ``` 2024-04-23 13:04:12.312 23654-24514 libc app.debug A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x68 in tid 24514 (DartWorker), pid 23654 (elematics.debug) 2024-04-23 13:04:12.505 2782-5399 FreecessController system_server D app.debug(10437) is important[12] 2024-04-23 13:04:13.318 24520-24520 DEBUG crash_dump64 A Cmdline: app.debug 2024-04-23 13:04:13.318 24520-24520 DEBUG crash_dump64 A pid: 23654, tid: 24514, name: DartWorker >>> app.debug <<< 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #00 pc 00000000002d25f4 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #01 pc 00000000003e53ec /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #02 pc 00000000003e8540 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #03 pc 00000000003ea934 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #04 pc 00000000003e5cd0 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #05 pc 000000000023d1b0 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #06 pc 000000000025ece4 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #07 pc 0000000000258a58 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #08 pc 000000000025f68c /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #09 pc 0000000000237828 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #10 pc 00000000002371f8 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #11 pc 0000000000250078 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (BuildId: 40e72f97fa135049) 2024-04-23 13:04:13.319 24520-24520 DEBUG crash_dump64 A #12 pc 0000000000330278 /data/app/~~yR97Vv37PS4uEkK4tb0V7g==/app.debug-IBIQ16zFv_CAxj9HjpMnEA==/base.apk!libpdfium.so (offset 0x4b2b000) (FPDF_LoadPage+168) (BuildId: 40e72f97fa135049) ```
espresso3389 commented 3 weeks ago

Basically, on pdfrx architecture, worker.compute ensures only one API call is invoked at same time. No concurrency issues if worker.compute has no bug.

And the code there is straight enough, just calling FPDF_LoadPage, FPDF_GetPageWidthF, FPDF_GetPageHeightF, FPDFPage_GetRotation, and FPDF_ClosePage. No tricky code there.

I have no idea what's wrong...

ThomasAunvik commented 3 weeks ago

Could also to see with the render function? I think at least some errors at that same FPDF_LoadPage? Bit weird, i do able to see first pages of the pdf, and then crashes after a second, or immidiately.

https://github.com/espresso3389/pdfrx/blob/5717726e31dbfcaee7bba0d332c260ab62d7a095/lib/src/pdfium/pdfrx_pdfium.dart#L578-L580

espresso3389 commented 3 weeks ago

Every function that calls FPDF_LoadPage including render function uses document._worker.compute so that every the function call is blocked each other. In theory, it does not cause any race condition issues.

By the way, what device do you just now? Is the issue is fully producible on every device?

ThomasAunvik commented 3 weeks ago

I use a Samsung S23+ SM-S916B/DS Android Version 14.

I'll have to test later tomorrow on emulators if I have the same issues there.

And see if I can make an example reproducible.

ThomasAunvik commented 3 weeks ago

Ok, so i found out why i was crashing. And it's pretty stupid of me to now realize why i did it.

I called PdfDocument.openData (without await) (to be used as a future later on if i wanted to have a page specific view) and then used PdfViewer.data to view the whole pdf.

Not sure exactly what caused it in totality, but my class consisted of this basically.

Widget build(BuildContext context) {
    if (mobile) {
      return PdfViewer.data(document.data, sourceName: "memreport");;
    }

   return FutureBuilder<PdfDocument>(
        future: document.pdfdoc,
}

removed the extra PdfDocument.openData and the bottom part to only use pdfviewer fixed it.