[Libguestfs] [nbdkit PATCH] tests: Don't strand hung nbdkit processes
Eric Blake
eblake at redhat.com
Fri Mar 20 19:56:37 UTC 2020
On 3/20/20 2:47 PM, Eric Blake wrote:
> We've recently been hitting a transient hung rpm build when using make
> 4.3, due to a bug in test-nbd-tls-psk.sh. We're still trying to
> isolate the correct fix for that bug (it might be in the nbd plugin
> proper, but more likely is an issue in libnbd's tls handling of
> connection close), but in the meantime, this patch should at least
> cause a graceful fail rather than make hanging due to an nbdkit
> process that has hung.
>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> tests/functions.sh.in | 31 ++++++++++++++++++++++++++++---
> 1 file changed, 28 insertions(+), 3 deletions(-)
To see the timeout in action, try applying this temporary patch, then
running
make -C tests check TESTS=test-nbd-extents.sh
diff --git i/plugins/data/data.c w/plugins/data/data.c
index cfbebc00..8c201ec0 100644
--- i/plugins/data/data.c
+++ w/plugins/data/data.c
@@ -81,10 +81,12 @@ data_load (void)
}
/* On unload, free the sparse array. */
+#include <unistd.h>
static void
data_unload (void)
{
free_sparse_array (sa);
+ sleep(15);
}
/* Parse the base64 parameter. */
diff --git i/tests/functions.sh.in w/tests/functions.sh.in
index e483505e..22840c86 100644
--- i/tests/functions.sh.in
+++ w/tests/functions.sh.in
@@ -152,14 +152,14 @@ kill_nbdkit ()
# Start with SIGTERM, and wait for graceful exit
kill $pid
- for i in {1..60}; do
+ for i in {1..10}; do
if ! kill -0 $pid 2>/dev/null; then
break
fi
sleep 1
done
# If nbdkit has not exited, try SIGKILL and fail the test
- if test $i = 60; then
+ if test $i = 10; then
echo "error: nbdkit pid $pid failed to respond to SIGTERM"
kill -9 $pid
# Append our failure after other cleanups
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the Libguestfs
mailing list