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

test: terminate WPT workers after test completion #37627

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/common/wpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ class WPTRunner {

this.results = {};
this.inProgress = new Set();
this.workers = new Map();
this.unexpectedFailures = [];
}

Expand Down Expand Up @@ -376,6 +377,7 @@ class WPTRunner {
scriptsToRun,
},
});
this.workers.set(testFileName, worker);

worker.on('message', (message) => {
switch (message.type) {
Expand Down Expand Up @@ -496,6 +498,9 @@ class WPTRunner {
this.resultCallback(filename, { status: 2, name: 'Unknown' });
}
this.inProgress.delete(filename);
// Always force termination of the worker. Some tests allocate resources
// that would otherwise keep it alive.
this.workers.get(filename).terminate();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's safe to ignore the Promise status, maybe add an empty catch handler?

Suggested change
this.workers.get(filename).terminate();
this.workers.get(filename).terminate().catch(() => {});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This promise can never reject

node/lib/internal/worker.js

Lines 344 to 354 in f3d3769

if (this[kHandle] === null) return PromiseResolve();
this[kHandle].stopThread();
// Do not use events.once() here, because the 'exit' event will always be
// emitted regardless of any errors, and the point is to only resolve
// once the thread has actually stopped.
return new Promise((resolve) => {
this.once('exit', resolve);
});
}

}

addTestResult(filename, item) {
Expand Down
2 changes: 1 addition & 1 deletion test/wpt/status/FileAPI/blob.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Blob-constructor.any.js": {
"skip": "https://github.com/nodejs/node/issues/37358"
"skip": "Depends on File API"
},
"Blob-constructor-dom.window.js": {
"skip": "Depends on DOM API"
Expand Down