pasta: Workaround occasional socat failures in CI

With a number of the port range forwarding tests, we've seen occasional
failures where the sending socat fails with an EINTR on connect().  This
was mitigated by e33f4e0bc742 "pasta: Use two connections instead of three
in TCP range forward tests" (which has been reverted and un-reverted
several times).  However, this did not eliminate the problem, for example
see [0].

For the failing tests we are using the socat address "EXEC:printf x" to
make socat invoke printf(1) to generate a single byte of data to transfer.
Closer analysis shows that the SIGCHLD as the printf process ends is
occasionally intersecting with the connect() call causing this failure.

This is arguably a bug in socat, to not handle this race one way or
another.  However, we can easily workaround the problem by using a
temporary file with the data to transfer, rather than invoking printf every
time.  Do this, to avoid the flakiness of these tests.

[0]
https://github.com/containers/podman/issues/17287#issuecomment-1611855165

Closes: https://github.com/containers/podman/issues/17287

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson
2023-06-29 15:47:56 +10:00
parent f0cb8dfe5b
commit 17cd5aecbb

View File

@ -105,12 +105,8 @@ function pasta_test_do() {
recv="EXEC:md5sum"
fi
# socat options for first <address> in client ("OPEN" or "EXEC"),
if [ "${bytes}" = "1" ]; then
send="EXEC:printf x"
else
send="OPEN:${XFER_FILE}"
fi
# socat first address
send="OPEN:${XFER_FILE}"
# and port forwarding configuration for Podman and pasta.
#
@ -136,6 +132,7 @@ function pasta_test_do() {
dd if=/dev/urandom bs=${bytes} count=1 of="${XFER_FILE}"
local expect="$(cat "${XFER_FILE}" | md5sum)"
else
printf "x" > "${XFER_FILE}"
local expect="$(for i in $(seq ${seq}); do printf "x"; done)"
fi