v134 · javascript
Async Resource Monitor
Track the full lifecycle of async resources — DB connections, file handles, HTTP clients, cache buckets — opened with await using and automatically disposed. See which resources are open, when they close, and what happens when a scope throws mid-flight.
checking Symbol.asyncDispose…
await using conn = await openDB() attaches Symbol.asyncDispose to conn. When the block exits — whether normally or via throw — the runtime awaits the disposer. Resources below show their open/disposed state in real time.
Active resources
0
Open
0
Disposed
0
Leaked
—
Avg lifetime (ms)
Run a scenario
Resource lifecycle log
Click "Run scenario" to start.
Pattern: await using with async dispose
// Each resource implements Symbol.asyncDispose
function makeDbConnection(name) {
const conn = {
name,
query: async (sql) => { /* ... */ },
[Symbol.asyncDispose]: async () => {
await closeSocket(conn); // async cleanup
console.log(`${name} connection closed`);
}
};
return conn;
}
// All resources auto-disposed — even if fetchData() throws
async function processOrder(orderId) {
await using db = makeDbConnection('orders');
await using cache = makeCacheClient('redis://...');
await using lock = await acquireLock(`order:${orderId}`);
const order = await db.query(`SELECT * FROM orders WHERE id = ?`, orderId);
const cached = await cache.get(`order:${orderId}`);
// ... process ...
// On exit (throw OR return): lock released, cache closed, db closed (LIFO)
}