Skip to content

Android PDF crash while scrolling | java.lang.IllegalStateException: Already closed #989

Open

Description

@sayoojkc

React native : 0.77.3
react-native-pdf : 7.0.3

Process: com.ey.eyinteractpayroll, PID: 3936
java.lang.IllegalStateException: Already closed
at io.legere.pdfiumandroid.util.ConfigKt.handleAlreadyClosed(Config.kt:24)
at io.legere.pdfiumandroid.PdfPage.close(PdfPage.kt:733)
at kotlin.io.CloseableKt.closeFinally(Closeable.kt:56)
at io.legere.pdfiumandroid.PdfiumCore.renderPageBitmap(PdfiumCore.kt:503)
at com.github.barteksc.pdfviewer.PdfFile.renderPageBitmap(PdfFile.java:301)
at com.github.barteksc.pdfviewer.RenderingHandler.proceed(RenderingHandler.java:109)
at com.github.barteksc.pdfviewer.RenderingHandler.handleMessage(RenderingHandler.java:66)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loopOnce(Looper.java:273)
at android.os.Looper.loop(Looper.java:363)
at android.os.HandlerThread.run(HandlerThread.java:85)

Activity

  1. changed the title [-]Android PDF crash while scrolling.[/-] [+]Android PDF crash while scrolling | java.lang.IllegalStateException: Already closed[/+] on Dec 9, 2025
  2. ersyhsyn commented on Dec 15, 2025

    @ersyhsyn

    same for me

  3. NJneeraj commented on Dec 18, 2025

    @NJneeraj

    When this issue will be fixed?

  4. MuhammadAnwaar9 commented on Dec 19, 2025

    @MuhammadAnwaar9

    same for me

  5. NJneeraj commented on Dec 19, 2025

    @NJneeraj

    Try this library react-native-pdf-crash-fix. It worked for me.

  6. ersyhsyn commented on Dec 22, 2025

    @ersyhsyn

    Try this library react-native-pdf-crash-fix. It worked for me.

    iOS not work for me.

  7. DuLe-FinX commented on Jan 5, 2026

    @DuLe-FinX

    @ersyhsyn

    iOS not work for me.

    it means can not fix this crash or can not render pdf?

  8. adammonteil commented on Jan 8, 2026

    @adammonteil

    +1

  9. ersyhsyn commented on Jan 8, 2026

    @ersyhsyn

    @ersyhsyn

    iOS not work for me.

    it means can not fix this crash or can not render pdf?

    not render pdf on iOS.

  10. coolsoftwaretyler commented on Feb 13, 2026

    @coolsoftwaretyler
    Contributor

    Hey folks, I think I've got a fix over in #999, along with a reproducer app using the patch in this other PR: coolsoftwaretyler/pdf-989-reproduction#1.

    I can only reproduce with certain PDFs. Not sure what the key difference is yet.

  11. Siddhantshelake commented on Jun 10, 2026

    @Siddhantshelake

    We upgraded to react-native-pdf@7.0.4, which includes PR #999, but we are still seeing IllegalStateException: Already closed in Crashlytics.

    Stack trace:

    Fatal Exception: java.lang.IllegalStateException: Already closed
    at io.legere.pdfiumandroid.util.ConfigKt.handleAlreadyClosed(Config.kt:24)
    at io.legere.pdfiumandroid.PdfPage.renderPageBitmap(PdfPage.kt:457)
    at io.legere.pdfiumandroid.PdfPage.renderPageBitmap$default(PdfPage.kt:445)
    at io.legere.pdfiumandroid.PdfiumCore.renderPageBitmap(PdfiumCore.kt:506)
    at com.github.barteksc.pdfviewer.PdfFile.renderPageBitmap(PdfFile.java:301)
    at com.github.barteksc.pdfviewer.RenderingHandler.proceed(RenderingHandler.java:109)
    at com.github.barteksc.pdfviewer.RenderingHandler.handleMessage(RenderingHandler.java:66)
    
    Can maintainers confirm whether PR #999 is expected to cover PdfPage.renderPageBitmap(...) as well as PdfPage.close(...)? Or is there another lifecycle/rendering race still open?
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions