Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardNodeJSasync_hooks execution contextSingle-choice MCQ

A senior engineer wires up an async_hooks instance and stores per-request state in a Map keyed by asyncId, populating it in the `init` callback and deleting it in `destroy`. Under load they see the Map growing without bound for requests that use a connection pool. Considering how V8/libuv manage async resource lifetimes, what is the most accurate root cause?

const hooks = require('async_hooks'); const store = new Map(); hooks.createHook({ init(asyncId, type, triggerAsyncId, resource) { store.set(asyncId, { type }); }, destroy(asyncId) { store.delete(asyncId); } }).enable();