Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Harden release backend cold-run qualification

Richard Courtman732486755685
diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
index 5d96fa7b0b..f69ff42a2c 100644
--- a/.github/workflows/create-release.yml
+++ b/.github/workflows/create-release.yml
@@ -361,9 +361,9 @@ jobs:
runs-on: ${{ !contains(inputs.version, '-') && 'ubuntu-24.04' || fromJSON('["self-hosted","Linux","X64","pulse-pve-tests"]') }}
# The rc.9 race-enabled API shards consumed more than 18 minutes on the PVE
# runner before post-step accounting. Keep the outer job above the canonical
- # 30-minute Go watchdog so checkout, bundle transfer, shard planning, and
+ # 45-minute API watchdog so checkout, bundle transfer, shard planning, and
# cleanup cannot pre-empt the process that owns stuck-package detection.
- timeout-minutes: 40
+ timeout-minutes: 55
env:
FRONTEND_DIST: frontend-modern/dist
steps:
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 4621b5371a..0d47b95fad 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -1866,11 +1866,42 @@ job ceiling during completion. That cancellation caused immutable readiness to
skip and the activation verdict to fail closed. GitHub release `378204006`
therefore remains an unpublished draft, its annotated tag and exact-version
artifacts remain immutable, convergence run `33131402971` made no customer
-pointer changes, and stable/latest remains `v6.3.2`. The canonical backend job
-now has a 40-minute ceiling while retaining the per-invocation 30-minute Go
-timeout, so setup, bundle transfer, planning, and cleanup overhead cannot
-pre-empt the test process or cancel a successfully completed release suite.
-`v6.4.0-rc.10` fixes forward from that infrastructure failure.
+pointer changes, and stable/latest remains `v6.3.2`. At the
+`v6.4.0-rc.10` source SHA, the backend job had a 40-minute ceiling while
+retaining the per-invocation 30-minute Go timeout, so setup, bundle transfer,
+planning, and cleanup overhead could no longer cancel a successfully completed
+suite. `v6.4.0-rc.10` fixed forward from that infrastructure failure.
+
+The active `v6.4.0-rc.10` qualification used exact source SHA
+`827017e196ede706d27876d27637712b5b165dcc` and release run `33132798478`.
+Its first attempt staged the immutable tag, draft, 217 exact-version assets,
+container images, Helm chart, and private runtime, while every non-backend
+release gate passed. The three-shard backend plan assigned all eight worker
+CPUs to API processes (`4/2/2`) while also running the non-API package graph
+with default Go concurrency. On a cold worker the prefix shard reached its
+cumulative 30-minute test-binary watchdog after completing 2,910 of its 3,624
+top-level tests; the two 15- and 16-test tails passed independently, so this
+was bounded runner oversubscription rather than an individual hung test. The
+unchanged immutable retry completed the full backend job in 11 minutes 52
+seconds. Activation recovery run `33135968998` then committed GitHub release
+`378221878` with 220 assets and an exact-lineage activation marker; canonical
+convergence owner `33135994780` passed Docker RC aliases, Helm Pages, and the
+private paid-runtime broker and released the global promotion lease. The
+release is public as a prerelease, while stable/latest remains `v6.3.2`.
+
+Future release qualification on `main` must not depend on a warm worker. On
+the canonical 8-vCPU, three-shard PVE plan, the backend runner reserves two
+single-CPU package workers for the non-API graph, gives the API shards a
+volume-weighted `4/1/1` allocation, passes `-p 2` to `go test`, and sets
+`GOMAXPROCS=1` for every non-API test binary. The combined declared width is
+therefore eight CPUs instead of eight API CPUs plus unbounded non-API package
+concurrency. Each
+API shard has a 45-minute cumulative watchdog, the non-API graph retains its
+30-minute watchdog, and the enclosing job has a 55-minute ceiling. Constrained
+one-vCPU hosts run the non-API graph before the API shard rather than knowingly
+oversubscribing the host. The deterministic CPU allocator and release guards
+pin this partition and reject a job ceiling that could pre-empt the API
+watchdog.
The preceding `v6.4.0-rc.8` qualification attempt used exact source SHA
`bac7e5d9526d76a6b4e34738511b07609dda80ed`. Release run `33128595650`
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 342ca75188..afc6793239 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -2958,12 +2958,12 @@ func TestReleaseBackendRaceGateUsesCompletePVEPartition(t *testing.T) {
t.Fatalf("read create-release.yml: %v", err)
}
backendJob := workflowJobBlock(t, string(workflowBytes), "backend_tests")
- if !strings.Contains(backendJob, "timeout-minutes: 40") {
+ if !strings.Contains(backendJob, "timeout-minutes: 55") {
t.Fatal("release backend job must retain the measured PVE execution ceiling with setup and cleanup headroom")
}
- for _, invalidCeiling := range []string{"timeout-minutes: 20", "timeout-minutes: 30"} {
+ for _, invalidCeiling := range []string{"timeout-minutes: 20", "timeout-minutes: 30", "timeout-minutes: 40"} {
if strings.Contains(backendJob, invalidCeiling) {
- t.Fatalf("release backend job must not restore a ceiling that can pre-empt the 30-minute Go watchdog: %s", invalidCeiling)
+ t.Fatalf("release backend job must not restore a ceiling that can pre-empt the 45-minute API watchdog: %s", invalidCeiling)
}
}
if !strings.Contains(backendJob, "pulse-pve-tests") || !strings.Contains(backendJob, "run-release-backend-tests.sh") {
@@ -2987,16 +2987,19 @@ func TestReleaseBackendRaceGateUsesCompletePVEPartition(t *testing.T) {
`2) echo $((8 * 1024 * 1024))`,
`*) echo $((10 * 1024 * 1024))`,
"Degrading to $cpu_shards API shard(s)",
- // Shard CPU is weighted by planned test volume: the serial prefix
- // shard measured 569s at 2 procs vs 484s at 4 on 2026-08-21, while
- // the wait-bound tails cannot use extra width.
+ // Shard CPU is weighted by planned test volume while two single-CPU
+ // package workers are reserved for the non-API graph. The canonical
+ // 8-vCPU plan is therefore 4/1/1 plus two, never oversubscribed.
"SHARD_GOMAXPROCS",
`GOMAXPROCS="$shard_procs"`,
+ "RESERVED_OTHER_PACKAGE_PROCS",
+ `GOMAXPROCS=1 PULSE_DATA_DIR="$RUN_ROOT/data/other"`,
+ `go test -race -p "$OTHER_PACKAGE_PROCS" -timeout 30m`,
+ `API_SHARD_TIMEOUT="${PULSE_BACKEND_API_SHARD_TIMEOUT:-45m}"`,
"--shard-boundaries",
"TestWebSocketOriginAllowsTrustedForwardedHostedOriginIPv6Loopback",
"TestServerInfoEndpointMethodNotAllowed",
- "go test -race -timeout 30m",
- `-test.timeout 30m`,
+ `-test.timeout "$API_SHARD_TIMEOUT"`,
} {
if !strings.Contains(backendScript, needle) {
t.Fatalf("PVE backend partition missing coverage contract: %s", needle)
diff --git a/scripts/release_control/internal/release_preflight_test.py b/scripts/release_control/internal/release_preflight_test.py
index 54e0dfd61d..6c58de1986 100755
--- a/scripts/release_control/internal/release_preflight_test.py
+++ b/scripts/release_control/internal/release_preflight_test.py
@@ -13,10 +13,32 @@ import unittest
ROOT = pathlib.Path(__file__).resolve().parents[3]
sys.path.insert(0, str(ROOT / "scripts"))
-from shard_go_tests import _test_regex, build_plan, write_plan
+from shard_go_tests import _test_regex, allocate_cpu_plan, build_plan, write_plan
class ReleasePreflightTest(unittest.TestCase):
+ def test_backend_cpu_plan_reserves_non_api_capacity_without_oversubscription(
+ self,
+ ) -> None:
+ widths, non_api = allocate_cpu_plan([3624, 15, 16], 8)
+ self.assertEqual(widths, [4, 1, 1])
+ self.assertEqual(non_api, 2)
+ self.assertEqual(sum(widths) + non_api, 8)
+
+ widths, non_api = allocate_cpu_plan([10, 10], 4)
+ self.assertEqual(widths, [1, 1])
+ self.assertEqual(non_api, 2)
+ self.assertEqual(sum(widths) + non_api, 4)
+
+ widths, non_api = allocate_cpu_plan([10], 1)
+ self.assertEqual(widths, [1])
+ self.assertEqual(non_api, 0)
+
+ for counts, vcpus in [([], 8), ([1], 0), ([1, 1], 1), ([0], 1)]:
+ with self.subTest(counts=counts, vcpus=vcpus):
+ with self.assertRaises(ValueError):
+ allocate_cpu_plan(counts, vcpus)
+
def run_script(
self, *args: str, env: dict[str, str] | None = None
) -> subprocess.CompletedProcess[str]:
@@ -423,6 +445,18 @@ class ReleasePreflightTest(unittest.TestCase):
)
self.assertIn("shard_admission_required_kib", backend)
self.assertIn("Degrading to $cpu_shards API shard(s)", backend)
+ self.assertIn(
+ 'API_SHARD_TIMEOUT="${PULSE_BACKEND_API_SHARD_TIMEOUT:-45m}"',
+ backend,
+ )
+ self.assertIn("RESERVED_OTHER_PACKAGE_PROCS", backend)
+ self.assertIn(
+ 'GOMAXPROCS=1 PULSE_DATA_DIR="$RUN_ROOT/data/other"', backend
+ )
+ self.assertIn(
+ 'go test -race -p "$OTHER_PACKAGE_PROCS" -timeout 30m', backend
+ )
+ self.assertIn('-test.timeout "$API_SHARD_TIMEOUT"', backend)
self.assertIn(
"TestWebSocketOriginAllowsTrustedForwardedHostedOriginIPv6Loopback,"
"TestServerInfoEndpointMethodNotAllowed",
diff --git a/scripts/run-release-backend-tests.sh b/scripts/run-release-backend-tests.sh
index 27722892d1..60bfd831bf 100755
--- a/scripts/run-release-backend-tests.sh
+++ b/scripts/run-release-backend-tests.sh
@@ -13,6 +13,8 @@ Options:
Maximum encoded -test.run regex bytes (default: 120000)
--memory-wait-seconds VALUE
Bounded wait for multi-shard memory admission (default: 120)
+ --api-shard-timeout VALUE
+ Cumulative watchdog for each API shard (default: 45m)
EOF
}
@@ -21,6 +23,7 @@ API_SHARDS="${PULSE_BACKEND_TEST_SHARDS:-auto}"
BATCH_SIZE=10000
MAX_REGEX_BYTES="${PULSE_BACKEND_TEST_MAX_REGEX_BYTES:-120000}"
MEMORY_WAIT_SECONDS="${PULSE_BACKEND_TEST_MEMORY_WAIT_SECONDS:-120}"
+API_SHARD_TIMEOUT="${PULSE_BACKEND_API_SHARD_TIMEOUT:-45m}"
SHARD_WEIGHTS="${PULSE_BACKEND_TEST_SHARD_WEIGHTS:-}"
SHARD_BOUNDARIES="${PULSE_BACKEND_TEST_SHARD_BOUNDARIES:-}"
@@ -46,6 +49,10 @@ while [ "$#" -gt 0 ]; do
MEMORY_WAIT_SECONDS="${2:-}"
shift 2
;;
+ --api-shard-timeout)
+ API_SHARD_TIMEOUT="${2:-}"
+ shift 2
+ ;;
-h|--help)
usage
exit 0
@@ -78,6 +85,10 @@ if [[ ! "$MEMORY_WAIT_SECONDS" =~ ^[0-9]+$ ]]; then
echo "Error: --memory-wait-seconds must be a non-negative integer." >&2
exit 2
fi
+if [[ ! "$API_SHARD_TIMEOUT" =~ ^[1-9][0-9]*(ms|s|m|h)$ ]]; then
+ echo "Error: --api-shard-timeout must be a positive Go duration using ms, s, m, or h." >&2
+ exit 2
+fi
for command_name in go python3 getconf awk pgrep; do
if ! command -v "$command_name" >/dev/null 2>&1; then
@@ -157,6 +168,10 @@ elif [[ ! "$API_SHARDS" =~ ^[1-9][0-9]*$ ]]; then
echo "Error: --api-shards must be auto or a positive integer." >&2
exit 2
fi
+if [ "$API_SHARDS" -gt "$VCPUS" ]; then
+ echo "Error: API shard count ($API_SHARDS) cannot exceed available vCPUs ($VCPUS)." >&2
+ exit 2
+fi
if [ -n "$SHARD_WEIGHTS" ] && [ -n "$SHARD_BOUNDARIES" ]; then
echo "Error: configure shard weights or shard boundaries, not both." >&2
@@ -176,6 +191,7 @@ echo " API shards: $API_SHARDS"
echo " Shard weights: ${SHARD_WEIGHTS:-none}"
echo " Shard boundaries: ${SHARD_BOUNDARIES:-automatic}"
echo " Memory wait: ${MEMORY_WAIT_SECONDS}s max"
+echo " API watchdog: $API_SHARD_TIMEOUT per shard"
echo " Batch size: $BATCH_SIZE"
echo " Regex bytes: $MAX_REGEX_BYTES max"
@@ -203,36 +219,44 @@ if [ -n "$SHARD_BOUNDARIES" ]; then
fi
python3 scripts/shard_go_tests.py "${plan_args[@]}"
-# CPU-weight each shard by its planned test volume. Top-level tests execute
-# serially inside one test-binary process, so a shard's wall time tracks the
-# serial duration of its range, not its CPU width — but the runtime, GC, and
-# race detector behind the canonical prefix shard's thousands of unit tests
-# still benefit from width the ~15-test wait-bound tail shards cannot use.
+# Partition the worker CPU budget between the API shards and the concurrently
+# running non-API package graph. Top-level API tests execute serially inside
+# one test-binary process, so a shard's wall time tracks the serial duration
+# of its range, not its CPU width — but the runtime, GC, and race detector
+# behind the canonical prefix shard's thousands of unit tests still benefit
+# from width the ~15-test wait-bound tail shards cannot use.
+#
# Direct 2026-08-21 worker probes measured the prefix shard at 569s with 2
-# procs and 484s with 4 while total allocation stayed at the worker's vCPU
-# count, so the volume-weighted split is a measured improvement with no
-# oversubscription risk.
-mapfile -t SHARD_GOMAXPROCS < <(python3 - "$PLAN_DIR/manifest.json" "$VCPUS" <<'PY'
+# procs and 484s with 4. RC.10 exposed that allocating all eight worker CPUs
+# to API shards while also launching the non-API graph left that graph's Go
+# package concurrency unbounded. Reserve two package slots where possible,
+# cap each non-API test binary to one CPU, and keep the combined declared
+# width at the worker's vCPU count.
+mapfile -t CPU_PLAN < <(python3 - "$PLAN_DIR/manifest.json" "$VCPUS" <<'PY'
import json
import sys
+sys.path.insert(0, "scripts")
+from shard_go_tests import allocate_cpu_plan
+
manifest = json.load(open(sys.argv[1]))
vcpus = int(sys.argv[2])
counts = [shard["test_count"] for shard in manifest["shards"]]
-total = sum(counts) or 1
-floor = 2 if vcpus >= 2 * len(counts) else 1
-budget = vcpus - floor * len(counts)
-extras = [int(round(budget * count / total)) for count in counts]
-drift = budget - sum(extras)
-extras[max(range(len(extras)), key=lambda i: counts[i])] += drift
-print("\n".join(str(floor + extra) for extra in extras))
+widths, reserved_other = allocate_cpu_plan(counts, vcpus)
+print(reserved_other)
+print("\n".join(str(width) for width in widths))
PY
)
+RESERVED_OTHER_PACKAGE_PROCS="${CPU_PLAN[0]}"
+OTHER_PACKAGE_PROCS="$RESERVED_OTHER_PACKAGE_PROCS"
+if [ "$OTHER_PACKAGE_PROCS" -eq 0 ]; then OTHER_PACKAGE_PROCS=1; fi
+SHARD_GOMAXPROCS=("${CPU_PLAN[@]:1}")
if [ "${#SHARD_GOMAXPROCS[@]}" -ne "$API_SHARDS" ]; then
echo "Error: shard GOMAXPROCS plan produced ${#SHARD_GOMAXPROCS[@]} entries for $API_SHARDS shards." >&2
exit 4
fi
echo "API shard GOMAXPROCS: ${SHARD_GOMAXPROCS[*]}"
+echo "Non-API package workers: $OTHER_PACKAGE_PROCS (GOMAXPROCS=1 each)"
API_IMPORT_PATH="$(go list -f '{{.ImportPath}}' ./internal/api)"
mapfile -t OTHER_PACKAGES < <(
@@ -246,8 +270,8 @@ fi
run_other_packages() {
echo "Running ${#OTHER_PACKAGES[@]} non-API packages..."
- env PULSE_DATA_DIR="$RUN_ROOT/data/other" \
- go test -race -timeout 30m "${OTHER_PACKAGES[@]}"
+ env GOMAXPROCS=1 PULSE_DATA_DIR="$RUN_ROOT/data/other" \
+ go test -race -p "$OTHER_PACKAGE_PROCS" -timeout 30m "${OTHER_PACKAGES[@]}"
}
run_api_shard() {
@@ -273,15 +297,22 @@ run_api_shard() {
env \
GOMAXPROCS="$shard_procs" \
PULSE_DATA_DIR="$shard_dir/batch-$batch_index" \
- "$API_BINARY" -test.run "$regex" -test.timeout 30m
+ "$API_BINARY" -test.run "$regex" -test.timeout "$API_SHARD_TIMEOUT"
)
done
echo "Completed internal/api shard $shard_index in $((SECONDS - shard_started_seconds))s."
}
pids=()
-run_other_packages &
-pids+=("$!")
+# A one-vCPU host cannot reserve a concurrent package slot. Complete the
+# non-API graph first there; release workers have enough width for concurrent
+# execution through the normal path below.
+if [ "$RESERVED_OTHER_PACKAGE_PROCS" -eq 0 ]; then
+ run_other_packages
+else
+ run_other_packages &
+ pids+=("$!")
+fi
for shard_number in $(seq 1 "$API_SHARDS"); do
shard_index="$(printf '%02d' "$shard_number")"
run_api_shard "$shard_index" "${SHARD_GOMAXPROCS[$((shard_number - 1))]}" &
diff --git a/scripts/shard_go_tests.py b/scripts/shard_go_tests.py
index c874dd227c..59c841c9fe 100755
--- a/scripts/shard_go_tests.py
+++ b/scripts/shard_go_tests.py
@@ -29,6 +29,46 @@ def _digest(names: Sequence[str]) -> str:
return hashlib.sha256(payload).hexdigest()
+def allocate_cpu_plan(
+ test_counts: Sequence[int], vcpus: int
+) -> tuple[list[int], int]:
+ """Allocate a non-oversubscribed CPU plan for API and non-API tests.
+
+ API shards each receive one CPU before remaining API capacity is assigned
+ proportionally by planned test count. Two CPUs are reserved for the
+ concurrent non-API package graph when the worker is wide enough, otherwise
+ one is reserved. A worker with no spare CPU must run the non-API graph
+ before its API shards.
+ """
+ counts = list(test_counts)
+ if not counts:
+ raise ValueError("test_counts must contain at least one API shard")
+ if vcpus < 1:
+ raise ValueError("vcpus must be at least 1")
+ if any(
+ isinstance(count, bool) or not isinstance(count, int) or count < 1
+ for count in counts
+ ):
+ raise ValueError("test_counts must contain positive integers")
+ if len(counts) > vcpus:
+ raise ValueError("API shard count cannot exceed available vCPUs")
+
+ reserved_other = min(2, vcpus - len(counts))
+ extra_budget = vcpus - reserved_other - len(counts)
+ total = sum(counts)
+ scaled = [extra_budget * count for count in counts]
+ extras = [value // total for value in scaled]
+ remaining = extra_budget - sum(extras)
+ by_remainder = sorted(
+ range(len(counts)),
+ key=lambda index: (scaled[index] % total, counts[index], -index),
+ reverse=True,
+ )
+ for index in by_remainder[:remaining]:
+ extras[index] += 1
+ return [1 + extra for extra in extras], reserved_other
+
+
def _test_regex(names: Sequence[str]) -> str:
root = _RegexTrie()
for name in names: