Skip to content

Crash Snapshot and Cross-Language Capture Survey ​

Status ​

  • Status: survey archive (2026-10-08, companion to Agent Supervisor #67 "survey first, decide later"; this document surveys only, it implements nothing). The §6 light + medium tier decision items landed with the S3 delivery (2026-10-10, see agent-supervisor-design.md §9)
  • Date: 2026-10-08
  • Scope: viable paths to obtain memory snapshots when supervised processes crash — ① per-language native mechanisms (Go/Python/Node/JVM); ② an OS-level language-agnostic capture layer (core_pattern/systemd-coredump, Windows WER, Crashpad/Breakpad); ③ the language-dependence of the parsing layer; ④ comparison and a tiered plan recommendation + decidable items
  • Conclusion at a glance: no single application-level tool covers everything; the evidence-backed combination is "an OS-level capture layer with zero integration (Linux core_pattern pipe / Windows WER LocalDumps) + language-native mechanisms for lightweight profiling + a per-language parsing layer". A Croupier-specific lever: supervised processes are spawned by the agent (ManagedProcesses configures command/env), so language-native switches can be injected at spawn time — the lightweight tier is significantly more feasible here than in the general case
  • Related: Agent Supervisor design profile §8 S3 (snapshot plan pending this document's decision, then merged)

1. Problem Definition ​

The game-server processes supervised by the Supervisor are written in different languages (Go/C++/Python/Node/JVM are all possible). Crash triage needs memory snapshots, but snapshot capture and parsing are two different things: the capture layer can be language-agnostic (the OS naturally owns all of a process's memory at termination), while the parsing layer is necessarily language-dependent (symbol tables, runtime object layouts). This survey proceeds along those two layers.

2. Language-Native Mechanisms ​

2.1 Go ​

MechanismFactsSources
runtime/pprof heapPredefined heap/allocs profiles; WriteTo emits a pprof snapshot; the heap profile reflects the point of "the most recently completed GC"; net/http/pprof can expose an endpoint for live pullspkg.go.dev/runtime/pprof
Sampling overheadruntime.MemProfileRate defaults to 512×1024 (one sample per 512KiB allocated on average); 1 = sample everything, 0 = off; runtime.MemProfile data lags by up to two GC cycles — low resident overheadpkg.go.dev/runtime
GOTRACEBACK=crashFive levels none/single(default)/all/system/crash/wer; the crash level "crashes in an OS-specific manner" — on Unix it raises SIGABRT to trigger a core dumppkg.go.dev/runtime
SIGQUITRegistered in the sigtable as _SigNotify+_SigThrow; relayed to all m's, then crash/exit — i.e. a full goroutine stack dump, then exit (a stack snapshot ≠ a memory snapshot)signal_unix.go
Core dump debug chainOfficial wiki: GOTRACEBACK=crash + Ctrl+\ triggers a core; gcore <pid> takes a core without killing the process; dlv core ./app core inspects it; ulimit -c defaults to 0 and must be raised; end-to-end on Linux onlyCoreDumpDebugging wiki · diagnostics
Delve attachdlv attach <pid> can debug a running process (a way to fetch heap info remotely, but attach has pause and permission costs)dlv_attach

2.2 Python ​

MechanismFactsSources
faulthandlerOn crash/timeout/signal dumps only tracebacks (ASCII, capped at 100 frames × 100 threads, no source, no memory contents); C-implemented, can hook SIGSEGV/FPE/ABRT/BUS/ILL, uses sigaltstack for stack-overflow safety, compatible with Apport-like system handlersfaulthandler
tracemallocRuntime allocation tracing; take_snapshot()/dump() capture snapshots of Python allocation blocks (not crash-specific); tracing itself has memory/CPU overhead, measurable via get_tracemalloc_memory()tracemalloc
gdb py-btNo official page found; unverified—

2.3 Node.js ​

MechanismFactsSources
--heapsnapshot-signalv12+; a signal triggers "write a heap dump" (Heap.*.heapsnapshot); off by default; whether the process survives after the write is undocumented (unverified)nodejs cli
Diagnostic ReportJSON report: JS/native stacks, V8 heap stats, libuv handles, environment variables; --report-on-signal (default SIGUSR2, unsupported on Windows), --report-on-fatalerror (OOM and other fatal errors); generation interrupts JS and the event loop; --report-exclude-env strips environment variablesnodejs report
CDP HeapProfilerinspector protocol takeHeapSnapshot; sampled heap profiling startSampling defaults to a Poisson distribution, averaging 32768 bytes per sample, stack depth 128CDP js_protocol

2.4 JVM ​

MechanismFactsSources
jcmd GC.heap_dumpProduces an HPROF full-heap dump; the official Impact annotation reads "High — depends on the Java heap size and content"; requests a full GC by default (-all avoids that)jcmd
HeapDumpOnOutOfMemoryError-XX:+HeapDumpOnOutOfMemoryError + -XX:HeapDumpPath; on OOM automatically writes java_pid<pid>.hprofjava(1)
jmap -dumpUsable but officially labeled "experimental and unsupported"jmap
HeapDumpOnCrashDoes not appear in the visible portion of the java(1) manual; unverified—

3. OS-Level Common Capture Layer (Language-Agnostic) ​

3.1 Linux: core dumps / core_pattern pipes / systemd-coredump ​

  • A core dump is "an image of the process's memory at termination", naturally language-agnostic; RLIMIT_CORE caps its size, but core_pattern pipe mode is not subject to that limit; when /proc/sys/kernel/core_pattern starts with |, the dump is piped via stdin to a user-space program (running as root in the initial namespace, Linux 2.6.19+) — core(5).
  • systemd-coredump takes over core_pattern via /usr/lib/sysctl.d/50-coredump.conf: the journal records a summary + backtrace, the core image is stored under /var/lib/systemd/coredump/ (.zst compressed, auto-deleted after days), and ProcessSizeMax/ExternalSizeMax default to 32G on 64-bit (767M limit inside the journal); coredumpctl list/debug hands the dump straight to gdb — systemd-coredump(8) · coredump.conf(5).
  • This route covers processes in any language with zero integration; Breakpad itself ships a core_handler (hooked into the core_pattern pipe to produce a system-wide minidump) as the "pipe → minidump" precedent — linux_core_handler.

3.2 Windows: WER LocalDumps ​

  • Registry HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps (global + per-application override subkeys): DumpType 1=Mini (default)/2=Full/0=Custom (CustomDumpFlags), DumpFolder defaults to %LOCALAPPDATA%\CrashDumps, DumpCount defaults to 10; not enabled by default — an administrator must write the registry; the source notes "apps that do their own custom crash reporting are not supported by this feature" — Microsoft Learn.

3.3 macOS ​

Crash reports are collected via the Xcode Crashes organizer / device transfers; jetsam (kill on high memory) is a separate report type — Apple docs. The ~/Library/Logs/DiagnosticReports path and the diagnose tool could not be verified from fetchable official pages (marked unverified). Server deployments are Linux-first; macOS is listed as a non-target.

3.4 Crashpad / Breakpad (Application-Level Cross-Platform Collectors) ​

  • Crashpad: the handler is a separate process; the client library is linked into the executable module at compile time; on crash the process is suspended and the handler generates the snapshot (modules/registers/stack memory/OS state) and writes a minidump; the design motive is "the crashed process's state is untrustworthy, so run as little code inside it as possible". Platform status from status.md: macOS/Windows/Linux/Android/Fuchsia clients complete, iOS in development — README · overview_design · status. Language-agnosticism has limits: the snapshot contents are OS-level entities (independent of implementation language), but the client is a compile-time C++ integration (sentry-native likewise requires C++17 and ships crashpad_handler with the program) — sentry-native.
  • Breakpad: no official deprecation statement found (the repo still had commits as of 2026-10); Crashpad is its successor within Chromium. On Linux it installs signal handlers inside the crashing process by default to write dumps, and the official docs warn themselves that "writing a minidump inside the crashing process is unsafe" — getting_started.

4. The Parsing Layer (Language-Dependent) ​

  • The minidump is a Windows user-mode format, "a useful subset of a crash dump, small enough to send over the network"; the client writes only "uninterpreted byte streams" (no function names/line numbers). Symbol chain: dump_syms (reads DWARF/PDB, must be produced before stripping) → .sym → minidump_stackwalk symbolizes — minidump-files · getting_started · Chromium decoding guide.
  • A modern alternative: Mozilla's rust-minidump (minidump-stackwalk/breakpad-symbols), whose README self-describes as "heavily modeled after Google Breakpad" — rust-minidump.
  • Go: the compiler emits DWARF by default (cmd/compile), so it could in theory feed dump_syms; but no official Breakpad/Crashpad Go client/support documentation was found — no mature precedent verified.
  • Java/Python: a minidump stores only raw stack bytes + registers; language-level stacks require language-side tooling (jstack output carries full class/method/line info) — jstack. For managed languages the value of an OS dump is mainly registers/native frames and memory contents; language stacks still need the native tools in parallel.

5. Comparison Table ​

OptionLanguage coveragePlatformsIntegration costOverheadArtifactParsing tools
Language-native (pprof etc.)One languageWhatever the runtime runs onLow (inject env/flags at spawn)Low (sampled) to high (jcmd full GC)pprof/hprof/heapsnapshotEach language's toolchain
core_pattern pipeAny (zero integration)LinuxLow (a handler script/program)Full memory snapshot, largecore or minidump (via core_handler)gdb / minidump toolchain
systemd-coredumpAnyLinux (systemd)Very low (system default)32G-scale reservation, compressed on diskcore (.zst)coredumpctl → gdb
WER LocalDumpsAny user-mode processWindowsVery low (registry)Per-app configurable dump typeminidump/fullWinDbg
Crashpad/BreakpadOS-level common; client needs C++ embeddingWin/macOS/Linux/AndroidHigh (source/build + handler distribution)Suspend → snapshot, low intrusionminidump(+extensions)minidump_stackwalk/rust-minidump

6. Tiered Plan Recommendation ​

Precondition fact: the croupier agent's supervised processes are spawned by the agent (ManagedProcesses: command/args/env), and the agent controls the process's launch environment — this is the key lever that makes the language-native tier feasible in Croupier's scenario (impossible in the general case).

TierPlanFit
LightSpawn-injected language-native switches (per-process snapshot profile): Go → GOTRACEBACK=crash + a pprof endpoint; Node → --heapsnapshot-signal/--report-on-fatalerror (with --report-exclude-env); Python → PYTHONFAULTHANDLER=1 (stacks) + tracemalloc on demand; JVM → -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<agent-managed directory>Default tier: low overhead, small artifacts, downloadable directly from the agent panel
MediumOS-level takeover as the fallback: on Linux write a core_pattern pipe handler (or accept the host's systemd-coredump as-is); on Windows register WER LocalDumps per-app; the agent scans dump artifact directories for panel listing + downloadGround truth fallback for crashes in any language; large and sensitive, off by default / allowlisted
HeavyCrashpad/Breakpad C++ embedding + the minidump symbol chainOnly if there is a C++ game server needing a unified cross-platform minidump; no such demand today, not chartered

Recommended combination: light (spawn injection) as default + medium (Linux core_pattern fallback) as an optional switch; Crashpad not introduced. Supporting facts: spawn control (code fact), core(5) pipe semantics covering everything with zero integration, native-mechanism overhead data (§2), and Crashpad integration cost with unverified Go support (§3.4/§4).

7. Sensitive Data and Production Discipline ​

  • A full dump/core/heapsnapshot contains the process memory in plaintext (credentials, keys, PII are all in memory); Node's Diagnostic Report embeds environment variables by default (often containing secrets) and requires an explicit --report-exclude-env (nodejs report); systemd-coredump's official docs likewise warn it contains all memory and is sensitive data.
  • Recommended production discipline: snapshots off by default, enabled per-process allowlist; tightened ACLs on the artifact directory + a retention cap (systemd-coredump's auto-expiry is a reference); panel downloads gated by an ops permission bit with audit logging; artifact size quotas (discard on breach and log an event, to keep disks from filling).

8. Decidable Items ​

  1. Starting tier: recommend "light = spawn injection (default) + medium = core_pattern fallback (optional)", rejecting a Crashpad/Breakpad charter (C++ integration cost vs. no C++ server demand today; no mature Go support precedent). Approved as "follow the survey's tiered plan" (recorded when the agent-supervisor design profile was filed, 2026-10-09).
  2. Light tier's config shape: ManagedProcesses[x].snapshotProfile: none|go|node|python|jvm (explicit declaration, no language auto-detection — a misjudgment's cost is an ineffective injection or a polluted process environment). Decided (2026-10-10, user-delegated): agreed, lands with the #67 S3 batch. Landed (2026-10-10): spawn injection (go/python/jvm env, node argv prepending, profile precedence) + snapshotDir (default logs/snapshots, 0700) + detect_down artifact registration.
  3. Medium tier's host prerequisite: core_pattern is a host-global resource (root sysctl); changing it on a host running multiple game servers has blast radius beyond the agent. Decided (2026-10-10, user-delegated): the agent gives read-only hints — scan the host's current state (whether core_pattern pipe mode is on) + show the suggested command in the panel/logs for ops to copy in one click; the agent does not write host config directly (permission/security boundary, low-stakes in both teaching and production). Landed (2026-10-10): read-only scan of /proc/sys/kernel/core_pattern; when not in pipe mode and any process enables the light tier, emit a single snapshot_hint host-level event (sync.Once against spam).
  4. Retention/quota/download permissions: suggest 72h retention, a 2GiB per-process directory quota, downloads requiring ops:operate + audit; numbers are tunable. Still pending decision (outside this authorization's scope).

9. Source Index ​

Go: runtime · runtime/pprof · diagnostics · CoreDumpDebugging · signal_unix.go · dlv attach · cmd/compile; Python: faulthandler · tracemalloc; Node: cli · report · CDP protocol; JVM: jcmd · java(1) · jmap · jstack; Platforms: core(5) · systemd-coredump(8) · coredump.conf(5) · WER LocalDumps · minidump-files · Apple crash reports; Collectors: Crashpad README · design · status · Breakpad getting_started · linux_core_handler · rust-minidump · sentry-native · Chromium decoding. Unverified items: gdb py-bt official docs, --heapsnapshot-signal post-write process liveness, JVM HeapDumpOnCrash, the macOS DiagnosticReports path, Breakpad's official Go support, and Valve/game-studio specific solutions.