From 13abc6adfb9f6a53618ca7d533d31b6a5d26dcec Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Wed, 5 Dec 2018 17:24:49 -0800 Subject: src: unload addons when environment quits This is an alternative to https://github.com/nodejs/node/pull/23319 which attaches the loaded addons to the environment and closes them when the environment is destroyed. PR-URL: https://github.com/nodejs/node/pull/24861 Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung --- test/abort/test-addon-uv-handle-leak.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/abort') diff --git a/test/abort/test-addon-uv-handle-leak.js b/test/abort/test-addon-uv-handle-leak.js index 96608f8dda..b67c5f7136 100644 --- a/test/abort/test-addon-uv-handle-leak.js +++ b/test/abort/test-addon-uv-handle-leak.js @@ -18,6 +18,16 @@ if (!fs.existsSync(bindingPath)) common.skip('binding not built yet'); if (process.argv[2] === 'child') { + + // The worker thread loads and then unloads `bindingPath`. Because of this the + // symbols in `bindingPath` are lost when the worker thread quits, but the + // number of open handles in the worker thread's event loop is assessed in the + // main thread afterwards, and the names of the callbacks associated with the + // open handles is retrieved at that time as well. Thus, we require + // `bindingPath` here so that the symbols and their names survive the life + // cycle of the worker thread. + require(bindingPath); + new Worker(` const binding = require(${JSON.stringify(bindingPath)}); -- cgit v1.2.3