public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/dotnet8.0] main: Reduce time to detect hanging builds
@ 2026-07-24 16:44 Omair Majid
0 siblings, 0 replies; only message in thread
From: Omair Majid @ 2026-07-24 16:44 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/dotnet8.0
Branch : main
Commit : a0ae897c20e5087d55aa819a091b890add482b36
Author : Omair Majid <omajid@redhat.com>
Date : 2026-07-24T12:44:22-04:00
Stats : +61/-2 in 1 file(s)
URL : https://src.fedoraproject.org/rpms/dotnet8.0/c/a0ae897c20e5087d55aa819a091b890add482b36?branch=main
Log:
Reduce time to detect hanging builds
Fail the build if it produces no output for a while, instead of a
hardcoded entire-build timeout of 5 hours.
Co-Authored-By: Tom Deseyn <tdeseyn@redhat.com>
---
diff --git a/dotnet8.0.spec b/dotnet8.0.spec
index 6cc8fa3..03b0b6a 100644
--- a/dotnet8.0.spec
+++ b/dotnet8.0.spec
@@ -576,8 +576,67 @@ function retry_until_success {
return $exit_code
}
+# Runs a command and kills it if it produces no output.
+# Use a longer timeout on machines with fewer cores since builds are slower.
+function output_timeout {
+ # 30m on machines with more than 4 cores, 60m on smaller machines where builds are slower.
+ # The aarch64 Neoverse N1 CI machines have 4 cores and need the longer timeout.
+ local nprocs=$(nproc)
+ local idle_timeout=1800
+ if (( nprocs <= 4 )); then
+ idle_timeout=3600
+ fi
+
+ # Create a pipe we'll read the output from for timeout detection.
+ local fifo=$(mktemp -u)
+ mkfifo "$fifo"
+
+ # Create a process group so we can kill every process including children.
+ # And use a long timeout (5h) in (the unlikely) case output timeout detection continues to be triggered.
+ setsid timeout --foreground 5h "$@" &> "$fifo" &
+ local cmd_pid=$!
+
+ # Read lines from the output with a timeout.
+ # Disable tracing to avoid 'set -x' noise from the read loop appearing in the output.
+ local timed_out=false
+ local traceflags=$-
+ set +x
+ while true; do
+ local rc=0
+ IFS= read -t $idle_timeout -r line || rc=$?
+ if (( rc == 0 )); then
+ printf '%s\n' "$line"
+ elif (( rc > 128 )); then
+ echo "output_timeout: no output for ${idle_timeout}s" >&2
+ timed_out=true
+ break
+ else
+ [[ -z $line ]] || printf '%s\n' "$line"
+ break
+ fi
+ done < "$fifo"
+ [[ $traceflags != *x* ]] || set -x
+
+ if $timed_out; then
+ # Hang detected: kill the process group, then collect the exit code.
+ kill -9 -- -$cmd_pid 2>/dev/null || true
+ wait $cmd_pid 2>/dev/null
+ local exit_code=$?
+ else
+ # Normal exit: collect the real exit code, then clean up any orphaned processes.
+ wait $cmd_pid 2>/dev/null
+ local exit_code=$?
+ kill -9 -- -$cmd_pid 2>/dev/null || true
+ fi
+
+ # Cleanup.
+ rm -f "$fifo"
+
+ return $exit_code
+}
+
VERBOSE=1 retry_until_success $max_attempts \
- timeout 5h \
+ output_timeout \
./build.sh \
%if %{without bootstrap}
--with-sdk previously-built-dotnet \
@@ -785,7 +844,7 @@ export COMPlus_LTTng=0
%changelog
-* Tue Jul 20 2026 Omair Majid <omajid@redhat.com> - 8.0.129-1
+* Mon Jul 20 2026 Omair Majid <omajid@redhat.com> - 8.0.129-1
- Update to .NET SDK 8.0.129 and Runtime 8.0.29
* Wed Jul 15 2026 Fedora Release Engineering <releng@fedoraproject.org> - 8.0.128-2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-24 16:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-24 16:44 [rpms/dotnet8.0] main: Reduce time to detect hanging builds Omair Majid
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox