Skip to content

Commit 3d49ad0

Browse files
committed
CI: Make MAD RTE perftest teardown leak-proof
A failed test run leaks the detached perftest server container: docker_stop_srv cats the log before docker stop, and when TestLid fails the GUID log is never created, so the cat aborts the script before the stop. The leaked server keeps the MAD agent registration on the HCA, so every following build's server dies with EINVAL and the client hangs until the 10-minute job timeout - all PRs go red until someone removes the zombie by hand. Stop the container before printing logs, sweep stale ucx_perftest_* containers before starting a new server, verify the detached server is actually alive so the failure surfaces in Setup Server with the real error, and bound the client with a timeout.
1 parent ed0bc4d commit 3d49ad0

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

buildlib/pr/mad_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
- checkout: none
7474
- bash: |
7575
source ./buildlib/tools/test_mad.sh
76-
docker_stop_srv LID
76+
docker_stop_srv
7777
docker_run_srv GUID
7878
displayName: Server Restart
7979
@@ -109,5 +109,5 @@ jobs:
109109
- checkout: none
110110
- bash: |
111111
source ./buildlib/tools/test_mad.sh
112-
docker_stop_srv GUID
112+
docker_stop_srv
113113
displayName: Server Stop

buildlib/tools/test_mad.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ build_ucx_in_docker() {
3434

3535
docker_run_srv() {
3636
local test_name="$1"
37+
local srv_log="${PWD}/ucx_perf_srv_${test_name}_${BUILD_BUILDID}.log"
3738
HCA=$(detect_active_ib_hca)
3839
sudo chmod 777 /dev/infiniband/umad*
40+
# A stale server from a previous run holds the MAD agent registration
41+
# on the HCA and makes every new server fail with EINVAL
42+
docker ps -aq --filter "name=ucx_perftest_" | xargs -r docker rm -f
3943
docker run \
4044
--rm \
4145
--detach \
@@ -48,13 +52,20 @@ docker_run_srv() {
4852
--ulimit memlock=-1:-1 --device=/dev/infiniband/ \
4953
$IMAGE \
5054
bash -c "${PWD}/install/bin/ucx_perftest -K ${HCA} > \
51-
${PWD}/ucx_perf_srv_${test_name}_${BUILD_BUILDID}.log 2>&1"
55+
${srv_log} 2>&1"
56+
# Fail here with the server error instead of hanging the client job
57+
sleep 5
58+
if [ -z "$(docker ps -q --filter "name=ucx_perftest_${BUILD_BUILDID}")" ]; then
59+
echo "Error: perftest server failed to start"
60+
cat "$srv_log" || true
61+
exit 1
62+
fi
5263
}
5364

5465
docker_stop_srv() {
55-
local test_name="$1"
56-
cat "${PWD}/ucx_perf_srv_${test_name}_${BUILD_BUILDID}.log"
57-
docker stop ucx_perftest_"$BUILD_BUILDID" || true
66+
# Stop first so the server never leaks; print whatever logs exist
67+
docker rm -f ucx_perftest_"$BUILD_BUILDID" || true
68+
cat "${PWD}"/ucx_perf_srv_*_"${BUILD_BUILDID}".log || true
5869
}
5970

6071
set_vars() {
@@ -77,7 +88,8 @@ set_vars() {
7788
run_mad_test() {
7889
local ib_address="$1"
7990
sudo chmod 777 /dev/infiniband/umad*
80-
"$PWD"/install/bin/ucx_perftest -t tag_bw -e -K "$HCA" -e "$ib_address"
91+
# Bounded wait: a dead server must fail the step, not stall the job
92+
timeout 300 "$PWD"/install/bin/ucx_perftest -t tag_bw -e -K "$HCA" -e "$ib_address"
8193
}
8294

8395
detect_active_ib_hca() {
@@ -93,7 +105,7 @@ detect_active_ib_hca() {
93105
}
94106
END {
95107
if (!found) {
96-
echo "Error: No active InfiniBand interface found"
108+
print "Error: No active InfiniBand interface found" > "/dev/stderr"
97109
exit 1
98110
}
99111
}

0 commit comments

Comments
 (0)