RuntimeError: memory access out of bounds while scrolling the page

(index) Value
UI version ‘8.7.0’
Core version ‘8.7.4’
webviewer.min.js ‘8.7.4’
Build ‘Ni8xNi8yMDIzfDhhZjQyYTgwOTU=’
WebViewer Server false
Full API false
Uncaught RuntimeError: memory access out of bounds
    at pdfjsexpress.wasm:0x1d8a
    at pdfjsexpress.wasm:0x1ded
    at pdfjsexpress.wasm:0x1f0d
    at pdfjsexpress.wasm:0x1f8c
    at e.value (PDFJSDocumentType.js:2625:207)
    at b (PDFJSDocumentType.js:2644:48)
    at r$jscomp$0 (PDFJSDocumentType.js:2644:312)
$func68 @ pdfjsexpress.wasm:0x1d8a
$func69 @ pdfjsexpress.wasm:0x1ded
$func70 @ pdfjsexpress.wasm:0x1f0d
$I#r @ pdfjsexpress.wasm:0x1f8c
value @ PDFJSDocumentType.js:2625
b @ PDFJSDocumentType.js:2644
r$jscomp$0 @ PDFJSDocumentType.js:2644
requestAnimationFrame (async)
r @ PDFJSDocumentType.js:2644
(anonymous) @ PDFJSDocumentType.js:2763
Promise.then (async)
(anonymous) @ PDFJSDocumentType.js:2762
n @ webviewer-core.min.js:2495
fa @ webviewer-core.min.js:2496
ca @ webviewer-core.min.js:2496
aa @ webviewer-core.min.js:2494
aa @ webviewer-core.min.js:2500
f @ webviewer-core.min.js:2501
postMessage (async)
ha @ webviewer-core.min.js:2502
ea.setImmediate @ webviewer-core.min.js:2503
w @ webviewer-core.min.js:2494
r @ webviewer-core.min.js:2496
f @ webviewer-core.min.js:2496
n @ webviewer-core.min.js:2495
(anonymous) @ PDFJSDocumentType.js:2673
Promise.then (async)
paintOnCanvas @ PDFJSDocumentType.js:2673
loadCanvasAsync @ PDFJSDocumentType.js:2762
nt @ webviewer-core.min.js:245
e.Uha @ webviewer-core.min.js:2173
(anonymous) @ webviewer-core.min.js:2167
e.VX @ webviewer-core.min.js:2167
e.zQ @ webviewer-core.min.js:2156
(anonymous) @ webviewer-core.min.js:2164
(anonymous) @ webviewer-core.min.js:2163
Promise.then (async)
e.WX @ webviewer-core.min.js:2163
(anonymous) @ webviewer-core.min.js:2164
requestAnimationFrame (async)
(anonymous) @ webviewer-core.min.js:2164
(anonymous) @ webviewer-core.min.js:2164
Promise.then (async)
e.WX @ webviewer-core.min.js:2164
(anonymous) @ webviewer-core.min.js:2164
requestAnimationFrame (async)
(anonymous) @ webviewer-core.min.js:2164
(anonymous) @ webviewer-core.min.js:2164
Promise.then (async)
e.WX @ webviewer-core.min.js:2164
(anonymous) @ webviewer-core.min.js:2164
requestAnimationFrame (async)
(anonymous) @ webviewer-core.min.js:2164
(anonymous) @ webviewer-core.min.js:2164
Promise.then (async)
e.WX @ webviewer-core.min.js:2164
(anonymous) @ webviewer-core.min.js:2160
Promise.then (async)
e.uZ @ webviewer-core.min.js:2160
(anonymous) @ webviewer-core.min.js:2161
setTimeout (async)
e.TR @ webviewer-core.min.js:2161
e.R5 @ webviewer-core.min.js:2160
(anonymous) @ webviewer-core.min.js:284
write @ webviewer-core.min.js:284
e.write @ webviewer-core.min.js:2179
(anonymous) @ webviewer-core.min.js:1299
(anonymous) @ webviewer-core.min.js:1299
requestAnimationFrame (async)
e.ML @ webviewer-core.min.js:1298
(anonymous) @ webviewer-core.min.js:1299
requestAnimationFrame (async)
e.ML @ webviewer-core.min.js:1298
(anonymous) @ webviewer-core.min.js:1299
requestAnimationFrame (async)
e.ML @ webviewer-core.min.js:1298
e.sm @ webviewer-core.min.js:1299
ba.onscroll @ webviewer-core.min.js:358
n @ webviewer-core.min.js:92

We have noticed that this error may occurr sometimes while “jumping to” a much larger page, with different dimensions and heavier graphics (dragging from page 1 to page 83, for example). The pages and thumbnails stops rendering and just show a blank page, with the original dimensions.

In our test scenario, our clients merge and mix ups different files, with different dimensions such as word documents, powerpoint presentations from diffrent providers, JPEGs, even DWGs converted to PDFs… so it is important to test not only plain PDF/A files but also unoptimized files.

We are able to provide the test file that raised this error, could you please provide an email address or other way to do so?

In the mean time, we are trying to recording a loom video showing the steps to reproduce.

Best regards
Leo Baggio

https://www.loom.com/share/95d85ab5c9bb4087abd1aba1ff2f78e5?sid=cd57b1f9-1da1-4132-b838-68537731047e

Here follows a video where I’ve been able to reproduce the error. I’ve started scrolling the file and then suddenly it stops to render. When I go to the console, there is some “memory access out of bounds” errors as mentioned earlier.

I also show that my system has plenty resources and some data at Chrome Developer Tools Memory tab.

If there anything else I can do, please let me know.

Thank you for posting your question to our forum. We will provide you with an update as soon as possible.

Hi there,

You can DM me directly in the forum and send me an attachment to the PDF or a link to the PDF in the message.

Also, are you able to reproduce this issue on the demo?

Best regards,
Kevin Kim

hi @kkim, just sent you a DM.

not reproduced on the demo, but I have coded a “bare minimum” PDFjs.express Plus example, using the code below:

<!DOCTYPE html>
<html>
<!-- Import PDF.js Express as a script tag from the lib folder using a relative path -->
<script src='lib/webviewer.min.js'></script>
<body>
  <div id='viewer' style="width: 100%; height: calc(100vh - 62px); margin: 0 auto; "></div>
  <script>
    WebViewer({
      path: 'lib', // path to the PDF.js Express'lib' folder on your server
      licenseKey: 'Insert commercial license key here after purchase',
      initialDoc: new URLSearchParams(window.location.search).getAll("file")[0],
      // initialDoc: '/path/to/my/file.pdf',  // You can also use documents on your server
    }, document.getElementById('viewer'))
      .then(instance => {
        const docViewer = instance.Core.documentViewer;
        const annotManager = instance.Core.annotationManager;
        docViewer.addEventListener('documentLoaded', () => {
        });
      });
  </script>
</body>

</html>

I dont see how that would be much different from the demo

Hi there,

I didn’t get a file from your message,

Do you have any sample PDFs that you can share < 20mb that can reproduce the issue?
You can also try to reproduce it in the sample in the documentation page:

Best regards,
Kevin Kim

Hi there,

Thank you for providing the file, I was able to reproduce this issue.

This looks to be happening due to the increase in the JS heap size in the performance monitor:

Does this happen to any other documents? It looks like as you zoom in/out and rerender the page, the pages do load up.

Best regards,
Kevin Kim

I was not able to reproduce in other documents, but this is not guaranteed to be a file related issue, the viewer should be able to deal with it, right?

Also… What its the resolution for this bug? We have a very thight deadline to implement a new PDF Viewer technology in a specific module of our system. We’ve chosen PDFJS Express as a proof of concept, but this particular issue jeopardizes its overall reliability. @kkim

Hi there,

We don’t currently have this on our roadmap but, we will add it to the backlog for our product team to review for feasibility and viability.
We recommend Apryse WebViewer for a possible solution for your use-case, you can contact them here Contact Sales | Apryse

Best regards,
Kevin Kim

Hi there,

I catch a very similar error in console with merged pdf with mixed dimensions and big graphics. The difference is that pdf doesn’t render as a blank page, maybe I have a little lighter content, but it’s still the same error. For now, it doesn’t interfere with using the application, but I am reporting that it has occurred in other user.

Best regards,
Dorota