crashpoint

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package crashpoint holds the production-callable half of the crash-injection machinery: the Breakpoint hook and the environment variables that drive it. It deliberately depends on nothing beyond os and syscall so that production packages (for example store/wal and store/checkpoint) can embed crash-injection points without dragging the testing package — and the test-only subprocess runner — into their production binaries.

Build-tag gating

Breakpoint has two implementations selected at compile time by the gograph_crashinject build tag:

  • crashpoint_disabled.go (//go:build !gograph_crashinject) — the default. Breakpoint is an empty function that the compiler elides entirely: it reads no environment variable and links no syscall. This is what every released binary contains, so GOGRAPH_CRASH_AT can never make a production process kill itself, and there is no per-call overhead on the WAL-truncate and checkpoint paths.
  • crashpoint_enabled.go (//go:build gograph_crashinject) — the active hook. Breakpoint reads GOGRAPH_CRASH_AT and, on a matching name, sends SIGKILL to the current process. Only the deterministic crash-injection battery (internal/crashinject and cmd/crashinject-helper) is built with this tag.

The exported API (Breakpoint, EnvCrashAt, EnvCrashDir) is identical in both modes, so call sites never change. To exercise the crash battery, build and test with -tags gograph_crashinject.

The subprocess harness that spawns a child, sets these environment variables, and inspects the torn artefacts lives in the sibling package internal/crashinject; it re-exports the names defined here so existing call sites keep working.

Index

Constants

View Source
const EnvCrashAt = "GOGRAPH_CRASH_AT"

EnvCrashAt is the environment variable read by Breakpoint (in the gograph_crashinject build) to decide which named point should trigger a crash. Without that build tag Breakpoint ignores the variable entirely.

View Source
const EnvCrashDir = "GOGRAPH_CRASH_DIR"

EnvCrashDir is the environment variable that tells the helper binary where to place its artefacts (WAL files, temp data).

Variables

This section is empty.

Functions

func Breakpoint

func Breakpoint(string)

Breakpoint is a no-op in every build that omits the gograph_crashinject tag — which is every released binary.

It takes no action: it does not read GOGRAPH_CRASH_AT and links no syscall, so an inherited GOGRAPH_CRASH_AT value cannot make a production process kill itself, and there is no per-call overhead on the durability paths (store/wal.Writer.Truncate, store/checkpoint) that embed it. The compiler inlines this empty body to nothing.

The active crash-injection implementation lives in crashpoint_enabled.go and is compiled only under the gograph_crashinject build tag.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL