question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

There are memory leak phenomenon related to pdf.worker.js

See original GitHub issue

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in Mozilla Firefox

Description

Short description of the bug you encountered. => There are momery leak whenever I call a pdf document by react-pdf. In the end, my program suddenly stop and reload.

Steps to reproduce

Steps to reproduce the behavior:

=> I checked this result by Chrome devtool on Memory profiles VM instance. The number of VM instances start to increase whenever I reload a web page which use React-pdf module

  1. import { Document, Page, pdfjs } from 'react-pdf'; pdfjs.GlobalWorkerOptions.workerSrc = '//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js';
스크린샷 2019-12-31 00 01 05
  1. even if I didn’t use pdfjs.GlobalWorkerOptions.workerSrc, the number of VM instances is not increased at all, but it stop and reload like above. It looks like internally increasing pdf.worker.js import { Document, Page } from 'react-pdf'

Expected behavior

What you expected to happen? => On the moment of refreshing(F5) web page which has pdf function, react-pdf just adds another pdf.worker.js and don’t stop previous pdf.worker.js. After all, the current web page was stoped by chrome by force

Additional information

If applicable, add screenshots (preferably with browser console open) and files you have an issue with to help explain your problem.

Environment

  • Browser (if applicable) [Chrome 79.0.3945.88 ]
  • React-PDF version [ 4.1.0 ]:
  • React version [ 16.9.0 ]
  • Webpack version (if applicable) [ 4.40.2]:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
brentmitchcommented, Jan 14, 2020

This seems related to issue #452 Lingering Worker BLOB @oze4 has a solution and put a pull request ( #505 ) it just hasn’t been approved yet. I did my own build and tried it out. It did remove the web workers after the component unmounted.

0reactions
wojtekmajcommented, Jan 15, 2020

Fixed by #505.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pdf.js memory leak when generating thumbnails
The issue is that PDF.js doesn't seem to unload the PDF between runs. Loading 20 1MB PDF files usually leads to nw.js using...
Read more >
Memory leaks occur if the PDF Viewer reopens a document ...
Memory leaks occur if the PDF Viewer reopens a document multiple times in rapid succession. To whom it may concern, We are having...
Read more >
Educational Learning Theories: 2nd Edition
Social cognitive theory posits that people are not simply shaped by that environment; they are active participants in their environment. Bandura is ...
Read more >
TIP 57 Trauma-Informed Care in Behavioral Health Services
trauma refer to similar physical, psychological, and cognitive changes and symptoms that behav ioral health workers may encounter when they work ...
Read more >
FortiWeb 7.0.1 Trouble-shooting Guide - Amazon AWS
Check FortiWeb event logs to confirm if there is any high CPU or Memory usage when the issue occurs; (Log&Report > Event >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found