public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Omair Majid <omajid@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/dotnet9.0] main: Reduce time to detect hanging builds
Date: Fri, 24 Jul 2026 15:33:21 GMT [thread overview]
Message-ID: <178490720106.1.9490561875707516902.rpms-dotnet9.0-0ced22313116@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/dotnet9.0
Branch : main
Commit : 0ced22313116a3917f7f2a5b9af64e3ac4623f32
Author : Omair Majid <omajid@redhat.com>
Date : 2026-07-24T11:32:37-04:00
Stats : +62/-1 in 1 file(s)
URL : https://src.fedoraproject.org/rpms/dotnet9.0/c/0ced22313116a3917f7f2a5b9af64e3ac4623f32?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/dotnet9.0.spec b/dotnet9.0.spec
index bb8fdc8..dc3e7a7 100644
--- a/dotnet9.0.spec
+++ b/dotnet9.0.spec
@@ -675,6 +675,8 @@ function retry_until_success {
set +e
while [[ $exit_code != 0 ]] && [[ $tries != 0 ]]; do
(( tries = tries - 1 ))
+ # Clean stale build state so retries start fresh.
+ rm -rf .packages $(find . -name artifacts -type d)
"$@"
exit_code=$?
done
@@ -682,8 +684,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 \
--source-only \
--release-manifest %{SOURCE5} \
reply other threads:[~2026-07-24 15:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178490720106.1.9490561875707516902.rpms-dotnet9.0-0ced22313116@fedoraproject.org \
--to=omajid@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox