Skip to contentSkip to conversation

avoid Travis CI "no log output for 10 minutes" failure

RFC PATCH In review Philippe Mathieu-Daudé 2 participants 4 messages Jul 13, 2017

lore
Share & tools
lore
#0 lore raw

cover avoid Travis CI "no log output for 10 minutes" failure

Hi, still trying to reduce Travis false negatives...

Suggested yesterday on IRC:
pm215: this one seems to be that we hit the "10 minutes with no output" limit
stefanha: f4bug: We could literally have a SIGALRM that wakes up to print out a '.' :-)

Let's try with an easy shell script.

This doesn't solve the 50min TO problem which is a different issue, but seems to work a bit more stable:

https://travis-ci.org/philmd/qemu/builds/253032034

tagged 'RFC' because it's just a PoC script without comment.

Regards,

Phil.

PD: sorry, resent since I forgot to Cc: [email protected] :S

Philippe Mathieu-Daudé (2):
scripts: helper to keep console alive
travis: use console aliveness script

 .travis.yml          |  2 +-
 MAINTAINERS          |  1 +
 scripts/aliveness.sh | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100755 scripts/aliveness.sh
Signature · 1 line
2.13.2
#1 lore raw

RFC PATCH 1/2 scripts: helper to keep console alive

useful to avoid Travis CI jobs getting killed after 10min of inactivity.

---
 MAINTAINERS          |  1 +
 scripts/aliveness.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100755 scripts/aliveness.sh
MAINTAINERS +1 -0
index 9529c9484c..c39f418a13 100644
@@ -1866,6 +1866,7 @@ S: Maintained
 F: .travis.yml
 F: .shippable.yml
 F: tests/docker/
+F: scripts/aliveness.sh
 W: https://travis-ci.org/qemu/qemu
 W: https://app.shippable.com/github/qemu/qemu
 W: http://patchew.org/QEMU/
scripts/aliveness.sh new file +32 -0
new file mode 100755
index 0000000000..1c2b6136b9
@@ -0,0 +1,32 @@
+#! /usr/bin/env sh
+#
+# Send an "Alive!" message regularly to stderr
+#
+# Copyright (C) 2017 Philippe Mathieu-Daudé
+#
+# Author: Philippe Mathieu-Daudé <[email protected]>
+#
+# This work is licensed under the terms of the GNU LGPL, version 2+.
+# See the COPYING file in the top-level directory.
+
+TIMEOUT_S=$1
+shift 1
+{
+  set -e
+  while true
+  do
+    sleep ${TIMEOUT_S}
+    echo "Alive!" >&2
+  done
+} &
+WATCHDOG_PID=$!
+
+cleanup() {
+    echo "killing watchdog ${WATCHDOG_PID}" >&2
+    kill -TERM ${WATCHDOG_PID}
+    exit $((1 - $#))
+}
+trap cleanup INT
+
+$*
+cleanup 0
Signature · 1 line
2.13.2
#2 lore raw

Re: [Qemu-devel] [RFC PATCH RESEND 1/2] scripts: helper to keep console alive

scripts/aliveness.sh line 1

Quoted 13 lines · Philippe Mathieu-Daudé

useful to avoid Travis CI jobs getting killed after 10min of inactivity.

---
 MAINTAINERS          |  1 +
 scripts/aliveness.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100755 scripts/aliveness.sh

+++ b/scripts/aliveness.sh

scripts/aliveness.sh new file +1 -0
@@ -0,0 +1,32 @@
+#! /usr/bin/env sh

Overkill. /bin/sh exists everywhere, the only need for using 'env' is where a program does not have a reliable installation path across platforms.

Quoted 16 lines
scripts/aliveness.sh new file +16 -0
+#
+# Send an "Alive!" message regularly to stderr
+#
+# Copyright (C) 2017 Philippe Mathieu-Daudé
+#
+# Author: Philippe Mathieu-Daudé <[email protected]>
+#
+# This work is licensed under the terms of the GNU LGPL, version 2+.
+# See the COPYING file in the top-level directory.
+
+TIMEOUT_S=$1
+shift 1
+{
+  set -e
+  while true
+  do

scripts/aliveness.sh line 27

Quoted 10 lines
scripts/aliveness.sh new file +10 -0
+    sleep ${TIMEOUT_S}
+    echo "Alive!" >&2
+  done
+} &
+WATCHDOG_PID=$!
+
+cleanup() {
+    echo "killing watchdog ${WATCHDOG_PID}" >&2
+    kill -TERM ${WATCHDOG_PID}
+    exit $((1 - $#))

This looks odd - what are you really trying to accomplish here? A different exit status according to whether the watchdog exited normally or was killed? A reflection of the exit status of the command being run in parallel with the watchdog?

scripts/aliveness.sh line 29

Quoted 2 lines
scripts/aliveness.sh new file +2 -0
+}
+trap cleanup INT

Don't you want to clean up on more than just INT? The more typical spelling is:

trap cleanup 0 1 2 3 15

Review line 31

Quoted 2 lines
(quoted diff) +2 -0
+
+$*

Huh? Oh, you're expecting this to be called as "aliveness.sh $TIMEOUT $command to run". Some usage comments would be nice.

Quoted 2 lines
scripts/aliveness.sh new file +1 -0
+cleanup 0
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#3 lore raw

RFC PATCH 2/2 travis: use console aliveness script

In reply to Philippe Mathieu-Daudé

Travis CI has specific time limits for each job, and will stop the build and add an error message to the build log in the following situation[s]:
- A job produces no log output for 10 minutes

See: https://docs.travis-ci.com/user/customizing-the-build#build-timeouts

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.travis.yml +1 -1
index 27a2d9cfb3..032d111bb4 100644
@@ -45,7 +45,7 @@ notifications:
     on_failure: always
 env:
   global:
-    - TEST_CMD="make check"
+    - TEST_CMD="scripts/aliveness.sh 69 make check"
   matrix:
     - CONFIG=""
     - CONFIG="--enable-debug --enable-debug-tcg --enable-trace-backends=log"
Signature · 1 line
2.13.2