diff --git a/src/node.cc b/src/node.cc index 486ed9435a7fa3..66740be90dd554 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4523,7 +4523,11 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, if (more) continue; + fprintf(stderr, "before emitting beforeExit. alive = %d\n", uv_loop_alive(env.event_loop())); + uv_print_all_handles(env.event_loop(), stderr); EmitBeforeExit(&env); + fprintf(stderr, "after emitting beforeExit. alive = %d\n", uv_loop_alive(env.event_loop())); + uv_print_all_handles(env.event_loop(), stderr); // Emit `beforeExit` if the loop became alive either after emitting // event, or after running some callbacks. diff --git a/src/node_perf.cc b/src/node_perf.cc index f5aafbab63a781..90e295ae9431f3 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -213,8 +213,10 @@ void MarkGarbageCollectionEnd(Isolate* isolate, void* data) { Environment* env = static_cast(data); uv_async_t* async = new uv_async_t(); // coverity[leaked_storage] + fprintf(stderr, "shooting into the dark here.\n"); if (uv_async_init(env->event_loop(), async, PerformanceGCCallback)) return delete async; + uv_unref(reinterpret_cast(async)); async->data = new PerformanceEntry::Data(env, "gc", "gc", performance_last_gc_start_mark_, diff --git a/test/parallel/test-async-wrap-uncaughtexception.js b/test/parallel/test-async-wrap-uncaughtexception.js index 37557b4aacc341..ba8019fe05d8ad 100644 --- a/test/parallel/test-async-wrap-uncaughtexception.js +++ b/test/parallel/test-async-wrap-uncaughtexception.js @@ -13,7 +13,7 @@ let hooks = null; process.on('beforeExit', common.mustCall(() => { process.removeAllListeners('uncaughtException'); - hooks.disable(); + //hooks.disable(); assert.strictEqual(typeof call_id, 'number'); assert.deepStrictEqual(call_log, [1, 1, 1, 1]); })); @@ -33,7 +33,8 @@ hooks = async_hooks.createHook({ }).enable(); -process.on('uncaughtException', common.mustCall(() => { +process.on('uncaughtException', common.mustCall((exception) => { + process._rawDebug('uncaughtException sees exception:', exception); assert.strictEqual(call_id, async_hooks.executionAsyncId()); call_log[2]++; })); @@ -42,5 +43,5 @@ process.on('uncaughtException', common.mustCall(() => { require('crypto').randomBytes(1, common.mustCall(() => { assert.strictEqual(call_id, async_hooks.executionAsyncId()); call_log[1]++; - throw new Error(); + throw new Error('this exception should be seen by uncaughtException'); }));