add automatic heap snapshots for high-memory cli processes (#20788)

This commit is contained in:
Dax
2026-04-02 22:34:33 -04:00
committed by GitHub
parent 8daeacc989
commit aa2239d5de
4 changed files with 66 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import { Flag } from "@/flag/flag"
import { setTimeout as sleep } from "node:timers/promises"
import { writeHeapSnapshot } from "node:v8"
import { WorkspaceID } from "@/control-plane/schema"
import { Heap } from "@/cli/heap"
await Log.init({
print: process.argv.includes("--print-logs"),
@@ -23,6 +24,8 @@ await Log.init({
})(),
})
Heap.start()
process.on("unhandledRejection", (e) => {
Log.Default.error("rejection", {
e: e instanceof Error ? e.message : e,