From bee30b43d2fd35259495e00a812c7d7eec2756f8 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 21 Nov 2019 12:35:04 +1100 Subject: [PATCH] Only wait for checksum processes When running under nodepool in a foreground, non-daemonized situation without a tty (i.e. within a container) we're seeing this "wait" hang indefinitely. It is probably related to "outfilter.py" and output file descriptors, although TBH we haven't completely root-caused it. I won't claim this is a great solution, but it should hopefully let the dib process finish and just die, where outfilter will disappear. Change-Id: If78da54df3d4c240fee16aee4413ec554b37c1d6 --- diskimage_builder/lib/common-functions | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/diskimage_builder/lib/common-functions b/diskimage_builder/lib/common-functions index 0549c2c48..71c9471c5 100644 --- a/diskimage_builder/lib/common-functions +++ b/diskimage_builder/lib/common-functions @@ -66,9 +66,17 @@ function finish_image () { mv $OUT_IMAGE_PATH $1 if [ "$DIB_CHECKSUM" == "1" ]; then - # NOTE(pabelanger): Read image into memory once and generate both checksum - # files. - md5sum $1 > $1.md5 & sha256sum $1 > $1.sha256 & wait + + # NOTE(pabelanger): Read image into memory once and generate + # both checksum files. + # NOTE(ianw): we've seen issues with this waiting for + # our outfilter.py wrapper when containerised (probably due to + # no tty). Waiting for just these processes is a bit of hacky + # workaround ... + declare -a wait_for + md5sum $1 > $1.md5 & wait_for+=($!) + sha256sum $1 > $1.sha256 & wait_for+=($!) + wait "${wait_for[@]}" fi echo "Image file $1 created..." }