-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed as not planned
Description
🐛 Bug Report
Running jest --detectLeaks exits with a segmentation fault, if there is a leak.
I've narrowed this down to agent-base@4, which includes something like:
const https = require('https');
https.get = () => ({});
To Reproduce
Clone the repo, and run npm ci && npm test.
Or, test (with --detectLeaks) any project that, at any point, transitively includes the old agent-base, for example, mailgun-js.
Expected behavior
The leak detector is detecting that there's a leak, and reporting it before segfaulting, but I feel that maybe it would be better if it didn't segfault.
Link to repl or repo (highly encouraged)
https://github.com/FauxFaux/testcase-jest-leak
envinfo
System:
OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Binaries:
Node: 12.18.2 - ~/bin/node
Yarn: 1.22.0 - ~/.npm-packages/bin/yarn
npm: 6.14.5 - /usr/bin/npm
Tested node 12, 14 and HEAD (5487054225e3002a72be3fab2605725c0a89c8a4).
Stack trace on HEAD
In a debug build of node, in gdb, it gets to delete reference;:
(gdb) bt
#0 0x000055b9ea33b3b2 in v8impl::(anonymous namespace)::RefBase::Delete (reference=0x55b9f0c59630) at ../src/js_native_api_v8.cc:244
#1 0x000055b9ea33b50e in v8impl::(anonymous namespace)::RefBase::Finalize (this=0x55b9f0c59630, is_env_teardown=true)
at ../src/js_native_api_v8.cc:283
#2 0x000055b9ea36d490 in v8impl::RefTracker::FinalizeAll (list=0x55b9f0e7a6b8) at ../src/js_native_api_v8.h:43
#3 0x000055b9ea36d5c2 in napi_env__::~napi_env__ (this=0x55b9f0e7a680, __in_chrg=<optimised out>) at ../src/js_native_api_v8.h:66
#4 0x000055b9ea36f85c in node_napi_env__::~node_napi_env__ (this=0x55b9f0e7a680, __in_chrg=<optimised out>) at ../src/node_api.cc:14
#5 0x000055b9ea36f87c in node_napi_env__::~node_napi_env__ (this=0x55b9f0e7a680, __in_chrg=<optimised out>) at ../src/node_api.cc:14
#6 0x000055b9ea349487 in napi_env__::Unref (this=0x55b9f0e7a680) at ../src/js_native_api_v8.h:77
#7 0x000055b9ea367884 in v8impl::(anonymous namespace)::<lambda(void*)>::operator()(void *) const (__closure=0x0,
arg=0x55b9f0e7a680) at ../src/node_api.cc:89
#8 0x000055b9ea3678a8 in v8impl::(anonymous namespace)::<lambda(void*)>::_FUN(void *) () at ../src/node_api.cc:90
#9 0x000055b9ea310c78 in node::Environment::RunCleanup (this=0x55b9f0add130) at ../src/env.cc:617