You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native crash (SIGILL) when two PdfReaderStates render concurrently on Android #15
Setup: Two PdfReaderStates open at the same time, each with a different document, both rendering via PdfPage. In our case that's a HorizontalPager where each page hosts its own reader, so while swiping two pages are composed and rendering at once.
Result: Native crash after a few back-and-forth swipes:
Fatal signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0x798d366cb8 in tid 17098 (pdfium-worker-2)
Likely cause:openPdfDocument creates a dedicated pdfium-worker-N executor per document (PdfDocument.android.kt), so each document is serialised on its own thread. But PDFium itself is process-wide and not thread-safe (the POOL_SIZE = 1 comment already notes the shared FreeType FT_Library). With two documents open, two worker threads call into PDFium concurrently, which is a different problem from the intra-document case that POOL_SIZE guards against.
Suggested fix: Serialise all PDFium calls across documents, e.g. route render/pageSize/close through the single Pdfium.sharedDispatcher (or a global mutex) rather than a per-document executor.
Repro: Two PdfPages from two rememberPdfReaderState()s in a HorizontalPager, swipe back and forth repeatedly.
Activity
gazseatfrog commentedon Oct 12, 2026
Opened a fix for this in #16