-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
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
-
View the minimal reproducible example (source code):
https://gist.github.com/josepsanzcamp/c1f35173c39cf6908877fb28905090b6 -
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 -
The test renders 4 PDF documents concurrently.
-
Each document renders its pages sequentially, waiting for
render().promise. -
In v5.4.624 the error appears intermittently.
-
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
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