Closed ThomasAunvik closed 3 weeks ago
So, I now tested with the master branch a bit further, and added some prints between FPDF_LoadPage calls.
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
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...
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.
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?
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.
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.
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.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 ```