Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can web worker be killed off by browser silently ? (pdf.js issue)

Can web worker be killed off by browser silently?

The following happen in mobile/desktop safari and mobile chrome in iOS

When using pdf.js to render multiple pdfs (it use web worker to download and render the pdf), some web worker gone missing randomly. It happen randomly and , when happen, it happen to different pdf.

Also, when debug in code(we post message back to main thread for debug), found that web worker stop working at different point in code.

This is so hard to track down the problem because

  1. it fail silently without any error
  2. in safari, there is no any development tools to check web worker status. Unlike chrome, there is the "thread" section to see the threads being used.
  3. web worker api do not have any close/terminate event for us to log when it is being killed

Any advice would be great!

like image 706
Brian Lai Avatar asked Dec 10 '25 13:12

Brian Lai


1 Answers

So it looks like there is an issue with the Safari browser. It's recommended to file a bug report with the vendor. There are issues with the Safari like: a worker execution can be terminated by GC (https://bugs.webkit.org/show_bug.cgi?id=153317), due to "excessive" memory use or bug with JIT compilation (https://bugs.webkit.org/show_bug.cgi?id=138038).

The Chrome in iOS is the same Safari browser (https://developer.chrome.com/multidevice/ios/overview), so issues in the former are mostly the same issues.

So answering your question:

Can web worker be killed off by browser silently?

Yes, it can be.

like image 89
async5 Avatar answered Dec 13 '25 01:12

async5