Skip to content

[Bug]: Regression: "Invalid page request" when rendering multiple documents concurrently in v5.4.624 #20629

@josepsanzcamp

Description

@josepsanzcamp

Attach (recommended) or Link to PDF file

Since upgrading from pdf.js v5.4.530 to v5.4.624, rendering multiple PDF documents
concurrently can throw the following error:

Error: Invalid page request

This happens even when:

  • page numbers are valid
  • rendering is sequential per document
  • GlobalWorkerOptions.workerSrc is set only once

The exact same code works correctly in v5.4.530, without any modifications.

Web browser and its version

Firefox 147.0.3 (64-bit)

Operating system and its version

Linux debian 6.12.63+deb13-amd64

PDF.js version

v5.4.624

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. View the minimal reproducible example (source code):
    https://gist.github.com/josepsanzcamp/c1f35173c39cf6908877fb28905090b6

  2. Open the same example running directly in the browser (no build steps required):
    https://gist.githack.com/josepsanzcamp/c1f35173c39cf6908877fb28905090b6/raw/pdfjs-concurrent-documents-regression.html

  3. The test renders 4 PDF documents concurrently.

  4. Each document renders its pages sequentially, waiting for render().promise.

  5. In v5.4.624 the error appears intermittently.

  6. In v5.4.530 it never happens.

What is the expected behavior?

All documents should render without errors.

What went wrong?

Random Invalid page request errors are thrown.

Link to a viewer

https://gist.githack.com/josepsanzcamp/c1f35173c39cf6908877fb28905090b6/raw/pdfjs-concurrent-documents-regression.html

Additional context

  • Adding delays (setTimeout) does not prevent the issue
  • Rendering a single document works correctly
  • Rendering multiple documents without chaining render promises also works
  • The issue only appears when multiple documents render concurrently
    and pages are rendered sequentially per document

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions