Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't trigger worker-thread cleanup when destruction has already started #15575

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

Snuffleupagus
Copy link
Collaborator

Note how we're currently skipping all main-thread cleanup when document destruction has started, but for some reason we're still dispatching the "Cleanup" message. This seems like a simple oversight, since destruction will already invoke the BasePdfManager.cleanup method (on the worker-thread) to fully clear-out all caches.

Note how we're currently skipping all main-thread cleanup when document destruction has started, but for some reason we're still dispatching the "Cleanup" message.
This seems like a simple oversight, since destruction will already invoke the `BasePdfManager.cleanup` method (on the worker-thread) to fully clear-out all caches.
@Snuffleupagus
Copy link
Collaborator Author

Note in particular how the "Terminate" case triggers full clean-up, whereas it's only partial in the "Cleanup" case:

pdf.js/src/core/worker.js

Lines 792 to 806 in 9f5fd07

handler.on("Cleanup", function wphCleanup(data) {
return pdfManager.cleanup(/* manuallyTriggered = */ true);
});
handler.on("Terminate", function wphTerminate(data) {
terminated = true;
const waitOn = [];
if (pdfManager) {
pdfManager.terminate(new AbortException("Worker was terminated."));
const cleanupPromise = pdfManager.cleanup();
waitOn.push(cleanupPromise);

@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/4ff99bc3ac2fcf1/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/4ff99bc3ac2fcf1/output.txt

Total script time: 3.21 mins

  • Unit Tests: Passed

@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/16b5304fe72cb7e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/16b5304fe72cb7e/output.txt

Total script time: 4.40 mins

  • Integration Tests: Passed

@Snuffleupagus Snuffleupagus merged commit 951564d into mozilla:master Oct 14, 2022
@Snuffleupagus Snuffleupagus deleted the startCleanup-destroyed branch October 14, 2022 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants