Files
temporal/develop/github/monitor_test.sh
Stephan Behnke 51181b17cc Improve memory diagnostics for test jobs (#10742)
## What changed?

- Poll CI memory every 1s with cheap process snapshots.
- Capture pprof and process memory diagnostics when memory crosses
threshold, then every 30s while above it.
- Upload memory diagnostics artifacts from post-test reporting.

## Why?

Make OOM failures easier to diagnose before the runner terminates the
test process.

Example:
https://github.com/temporalio/temporal/actions/runs/29111099672/job/86424089913?pr=10742#step:7:77
2026-07-13 18:59:29 +00:00

33 lines
635 B
Bash
Executable File

#!/bin/bash
#
# Monitor Test
#
# Runs the given command with background monitoring.
#
# Usage:
# ./monitor_test.sh <command> [args...]
#
# Example:
# ./monitor_test.sh make functional-test-coverage
#
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <command> [args...]" >&2
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Run command
setsid "$@" &
COMMAND_PID=$!
MONITORED_PROCESS_GROUP="$COMMAND_PID"
# Start monitor
MONITORED_PROCESS_GROUP="$MONITORED_PROCESS_GROUP" "$SCRIPT_DIR/memory_monitor.sh" &
MONITOR_PID=$!
trap 'kill "$MONITOR_PID" 2>/dev/null || true' EXIT
wait "$COMMAND_PID"