Articles

Capture production 5xx crash snapshots and diff CPU or heap profiles

Capture microVM memory automatically on a production 5xx, fork it offline to debug safely, and diff CPU or heap flamegraphs across deploys.

Updated

Capture live memory snapshots automatically on your app's first production 5xx—fork that crashed state into an isolated sandbox to inspect it—and diff CPU or heap flamegraphs across deployments. On Gregale, crash snapshots (Pro and Scale) preserve crashed microVM memory for offline investigation without touching live traffic, while continuous profile diffs (Hobby, Pro, and Scale) rank CPU and heap growth across releases and canary stages. All capabilities described here are currently in preview.

Why logs alone miss production 5xx regressions

When a production backend hits a deadlock, subtle heap leak, or edge-case 500 after a rollout, logs rarely show the in-memory state, goroutines/coroutines, or heap objects present at failure time—and attaching a live debugger to a serving container risks taking down real users or losing state when the container restarts.

Traditional PaaS providers force a manual workflow: add extra logging, redeploy, try to reproduce the bug in staging, or wire external APM agents and continuous profilers separately.

Automatic 5xx crash snapshots and isolated forks

Enable automatic 5xx memory capture on an app (PUT /v1/apps/{slug}/crash-snapshots/settings) or trigger a manual capture of the newest running instance at any time (POST /v1/apps/{slug}/crash-snapshots):

  • Low-overhead automatic capture: When enabled, the first 5xx answered by an app instance captures that instance's memory snapshot. Gregale limits captures to at most one in flight and none within 10 minutes of the last, protecting serving instances from snapshot storms.
  • Open a crash snapshot as a production fork: Call POST /v1/apps/{slug}/crash-snapshots/{id}/fork (requires deploy:write and secrets:read; returns 409 crash_capture_not_ready until the capture is ready and unexpired).
  • Safe offline inspection: Gregale boots an isolated microVM restored directly from the captured crash memory (not the deployment's latest image) and returns a one-time access_token so engineers inspect the exact crashed state without affecting production traffic.

Differential CPU, heap, and lock profiling

Compare any two captured profiles of the same app with gregale debug capture diff or GET /v1/apps/{slug}/profiles/captures/{id}/diff?base=<uuid>&kind=heap:

  • Five capture kinds: cpu, heap, stacks, block, or mutex. Omitting kind selects a type present in both captures, preferring heap.
  • Growth-first call paths: Gregale merges baseline and candidate captures and sorts every call path and function by largest growth first. Values are never rescaled silently—if captures differ in duration or deployment, the API returns an explicit warning alongside the diff.

Automatic post-deploy and canary CPU checks

Configure automatic differential profiling after rollouts (PUT /v1/apps/{slug}/profiles/deployment-policy):

  • Equal-window baseline vs candidate comparison: Compares an equal baseline window ending before candidate creation against a matching post-rollout + warm-up window on the new candidate, retrying up to 5 times if profiling samples arrive late.
  • Canary stage assessments & saved investigations: Inspect per-stage canary CPU evidence (GET /v1/apps/{slug}/profiles/canary-checks/{deployment}), read 30-day deployment check receipts (GET /v1/apps/{slug}/profiles/deployment-checks), and save up to 50 comparison investigations without blocking rollout activation (checks are advisory).

Plans and maturity disclosure

CapabilityMaturityIncluded plansKey guardrails
Automatic 5xx snapshotsPreviewPro, Scale1 capture in flight, max 1 every 10 minutes per app
Crash snapshot forksPreviewPro, ScaleIsolated microVM fork with one-time access_token
Profile capture diffsPreviewHobby, Pro, Scalecpu, heap, stacks, block, mutex; 30-day receipts

How other platforms compare

CapabilityGregaleRender / Railway / Fly.ioGrafana Pyroscope / Datadog Continuous Profiler
Automatic 5xx memory snapshot forkBuilt-in (crash-snapshots + isolated fork, Pro/Scale preview)Not built in (metrics, logs, or container SSH only)Captures profiles, not forkable VM memory snapshots
Differential CPU & heap flamegraphsBuilt-in (debug capture diff + post-deploy/canary CPU checks)Not built inBuilt-in continuous flamegraph & release comparisons
Infra setup requiredZero-agent platform capture & APIMust self-host or wire external profiler agentsDeploy collector/SDK sidecar & manage external SaaS

Sources, checked 2026-11-27: Grafana Pyroscope Documentation, Datadog Continuous Profiler.

Pricing and docs

Profile captures unlock on Hobby, while automatic 5xx crash snapshots and crash-snapshot forks unlock on Pro and Scale. See Gregale pricing, Tracing & observability, Troubleshooting, Apps & diagnostics API, and Zero-code OpenTelemetry & SQL N+1 regression detection.

Questions

Will automatic 5xx crash snapshots overload a failing instance?

No. Gregale captures only the first 5xx per window, allowing at most one capture in flight and none within 10 minutes of the previous capture.

Does forking a crash snapshot affect live production traffic?

No. Forking boots a separate isolated microVM restored from the captured crash memory with its own one-time access token while live traffic continues untouched.

Which plans include crash snapshots vs profile capture diffs?

Both features are in preview: profile capture diffs unlock on Hobby, Pro and Scale, while automatic 5xx crash snapshots and crash-snapshot forks unlock on Pro and Scale.