diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-06-07 22:07:02 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-06-13 12:23:36 +0200 |
commit | aa2304b8d5c53ba2d9710d8b8ed4482f3cbd1192 (patch) | |
tree | 4bd93c9dd7f8a5fa0e04c4897b8e0aa7c1075225 /test/addons/uv-handle-leak/test.js | |
parent | 8e2d33f15620013de504c1181641aa961906f436 (diff) | |
download | android-node-v8-aa2304b8d5c53ba2d9710d8b8ed4482f3cbd1192.tar.gz android-node-v8-aa2304b8d5c53ba2d9710d8b8ed4482f3cbd1192.tar.bz2 android-node-v8-aa2304b8d5c53ba2d9710d8b8ed4482f3cbd1192.zip |
worker,src: display remaining handles if `uv_loop_close` fails
Right now, we crash the process if there are handles remaining
on the event loop when we exit (except for the main thread).
This does not provide a lot of information about causes, though;
in particular, we don’t show which handles are pending and
who own them.
This patch adds debug output to these cases to help with the
situation.
PR-URL: https://github.com/nodejs/node/pull/21238
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/addons/uv-handle-leak/test.js')
-rw-r--r-- | test/addons/uv-handle-leak/test.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/addons/uv-handle-leak/test.js b/test/addons/uv-handle-leak/test.js new file mode 100644 index 0000000000..73d40ca799 --- /dev/null +++ b/test/addons/uv-handle-leak/test.js @@ -0,0 +1,23 @@ +'use strict'; +const common = require('../../common'); +const bindingPath = require.resolve(`./build/${common.buildType}/binding`); +const binding = require(bindingPath); + +// This tests checks that addons may leak libuv handles until process exit. +// It’s really not a good idea to do so, but it tests existing behaviour +// that likely can never be removed for backwards compatibility. + +// This has a sibling test in test/abort/ which checks output for failures +// from workers. + +try { + // We don’t want to run this in Workers because they do actually enforce + // a clean-exit policy. + const { isMainThread } = require('worker_threads'); + if (!isMainThread) + common.skip('Cannot run test in environment with clean-exit policy'); +} catch {} + +binding.leakHandle(); +binding.leakHandle(0); +binding.leakHandle(1); |