async_hooks: Add destroy event for gced AsyncResources
In cases where libraries create AsyncResources which may be emitting more events depending on usage, the only way to ensure that destroy is called properly is by calling it when the resource gets garbage collected.
Fixes: https://github.com/nodejs/node/issues/16153
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
python tools/test.py -J --mode=release async-hooks/test-callback-error
fails for me on master as well as this branch...
Affected core subsystem(s)
doc, async_hooks
/cc @addaleax