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.

Keep a kill backstop on the bounded module download

pulse-triage[bot]745c1f9ce54a
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index ad637f729b..7420cecd91 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -7020,8 +7020,8 @@ The Docker backend builder uses `scripts/go-mod-download.sh` with the same
`go.mod`, `go.sum`, Go toolchain, proxy/sum database and module/build caches.
Only a failed download whose every diagnostic matches the observed HTTPS
HTTP/2 `stream error ... INTERNAL_ERROR; received from peer` may run again.
-There are at most three attempts, each bounded to 180 seconds, with two- and
-four-second delays. Every failed attempt's output remains visible. Access
+There are at most three attempts, each terminated at 180 seconds with a
+five-second KILL backstop, with two- and four-second delays. Every failed attempt's output remains visible. Access
refusals, checksum/integrity errors, unknown or mixed diagnostics, missing tools,
timeouts and signals stop with the observed nonzero exit; an exhausted transport
failure never becomes a success. No alternate endpoint or graph rewrite exists.
diff --git a/scripts/go-mod-download.sh b/scripts/go-mod-download.sh
index 34249df613..5289dce3b9 100644
--- a/scripts/go-mod-download.sh
+++ b/scripts/go-mod-download.sh
@@ -16,8 +16,9 @@ trap 'exit 143' TERM
attempt=1
while :; do
# Both Alpine BusyBox and GNU timeout support this fixed invocation.
- # An attempt timeout is a terminal failure, not a reason to retry.
- if timeout 180 go mod download >"$log" 2>&1; then
+ # TERM at 180 seconds has a five-second KILL backstop. A timeout
+ # is a terminal failure, not a reason to retry.
+ if timeout -k 5 180 go mod download >"$log" 2>&1; then
cat "$log"
exit 0
else
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index e9e788797b..cf8d3e52fc 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -5367,7 +5367,7 @@ func TestDockerModuleDownloadKeepsPinnedGraphAndBoundedRecovery(t *testing.T) {
"sh /usr/local/bin/pulse-go-mod-download",
)
assertFileContainsAll(t, repoFile("scripts", "go-mod-download.sh"),
- "timeout 180 go mod download", "[ \"$attempt\" -eq 3 ]", "INTERNAL_ERROR; received from peer",
+ "timeout -k 5 180 go mod download", "[ \"$attempt\" -eq 3 ]", "INTERNAL_ERROR; received from peer",
"exit !(seen && !unknown)",
)
// The automatic script-smoke discovery must execute the behavioural proof,
diff --git a/scripts/tests/test_go_mod_download.py b/scripts/tests/test_go_mod_download.py
index 4be41598ea..420419c7f1 100644
--- a/scripts/tests/test_go_mod_download.py
+++ b/scripts/tests/test_go_mod_download.py
@@ -50,9 +50,9 @@ sys.exit(status)
timeout = tools / 'timeout'
timeout.write_text('''#!/bin/sh
printf '%s\\n' "$*" >> "$DOWNLOAD_FIXTURE/timeout.calls"
-[ "$1" = 180 ] || exit 99
+[ "$1" = -k ] && [ "$2" = 5 ] && [ "$3" = 180 ] || exit 99
if [ -n "${FIXTURE_TIMEOUT_STATUS:-}" ]; then exit "$FIXTURE_TIMEOUT_STATUS"; fi
-shift
+shift 3
exec "$@"
''')
timeout.chmod(0o755)
@@ -81,7 +81,7 @@ exec "$@"
self.assertEqual(result.stdout, 'download complete\n')
self.assertEqual(len(calls), 1)
self.assertEqual(delays, [])
- self.assertEqual(timeouts, ['180 go mod download'])
+ self.assertEqual(timeouts, ['-k 5 180 go mod download'])
def test_docker_stage_recovers_observed_failure(self):
result, calls, delays, timeouts = self.run_download(
@@ -89,7 +89,7 @@ exec "$@"
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(len(calls), 2)
self.assertEqual(delays, ['2'])
- self.assertEqual(timeouts, ['180 go mod download'] * 2)
+ self.assertEqual(timeouts, ['-k 5 180 go mod download'] * 2)
self.assertIn(STREAM_ERROR, result.stderr)
def test_two_failures_can_recover_on_last_attempt(self):
@@ -157,7 +157,7 @@ exec "$@"
self.assertEqual(result.returncode, status)
self.assertEqual(calls, [])
self.assertEqual(delays, [])
- self.assertEqual(timeouts, ['180 go mod download'])
+ self.assertEqual(timeouts, ['-k 5 180 go mod download'])
def test_arbitrary_arguments_are_rejected_before_download(self):
result, calls, delays, timeouts = self.run_download([(0, '')], args=('-x',))