Files
Bobby Ho 11f1ee7d9f ci: fail the test process with a heap profile when memory passes a per-runner limit (#30487)
test: add memory guard and heap profiles for CI timeouts

Add a memory guard to `cli`, `agent`, and `enterprise/cli` to diagnose
recurring macOS `test-go-pg` timeouts. Recent logs show runaway memory
usage and heavy swapping, but the allocation source remains unknown.

- Check Go runtime memory once per second, with per-process CI limits
  of 5 GiB on macOS and 6 GiB on Linux and Windows. Disabled when
  `CODER_TEST_MEMORY_LIMIT_MIB` is unset.
- On exceeding the limit, save a heap profile, attempt a second profile
  after forced GC with a five-second wait limit, then panic with memory
  usage, profile paths, and all goroutine stacks.
- Upload heap profiles from unsuccessful CI jobs on every OS, retaining
  them for seven days.
- Test guard lifecycle, environment parsing, panic diagnostics, profile
  validity, and post-GC allocation attribution. Validate with race
  tests, vet, lint, and a manual macOS test.

Refs https://linear.app/codercom/issue/PLAT-251/flake-test-go-pg-macos-job-timeoutcancelled
Refs https://github.com/coder/internal/issues/1365
2026-10-14 12:32:49 -07:00
..
…
…
…
…
…
…
2026-06-03 15:37:19 -05:00
…
…
…
…
…
…
…