From dc663926433add8180999f5855d3c6b28b2c25c5 Mon Sep 17 00:00:00 2001 From: Rini Gupta Date: Thu, 8 Oct 2026 00:04:01 +0000 Subject: [PATCH 1/2] test: Deflake L0_socket reuse-port request distribution check Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- qa/L0_socket/test.sh | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/qa/L0_socket/test.sh b/qa/L0_socket/test.sh index 2fd37bd054..8e288a931f 100755 --- a/qa/L0_socket/test.sh +++ b/qa/L0_socket/test.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -387,22 +387,41 @@ for p in http grpc; do CLIENT_PY=../clients/simple_grpc_infer_client.py fi - pids=() - for i in {0..10}; do - python3 $CLIENT_PY >> $CLIENT_LOG 2>&1 & - pids+=" $!" + # The kernel assigns each new connection to one of the SO_REUSEPORT + # listeners by hashing the client address/port, so a single batch of + # clients can miss a server by chance. Keep sending batches until every + # server has served a request, up to MAX_CLIENT_ROUNDS. + MAX_CLIENT_ROUNDS=10 + for round in $(seq 1 $MAX_CLIENT_ROUNDS); do + pids=() + for i in {0..10}; do + python3 $CLIENT_PY >> $CLIENT_LOG 2>&1 & + pids+=($!) + done + for pid in "${pids[@]}"; do + wait $pid || { echo -e "\n***\n*** Python ${p} Async Infer Test Failed\n***"; cat $CLIENT_LOG; RET=1; } + done + + server0_request_count=`curl -s localhost:8002/metrics | awk '/nv_inference_request_success{/ {print $2}'` + server1_request_count=`curl -s localhost:8003/metrics | awk '/nv_inference_request_success{/ {print $2}'` + server2_request_count=`curl -s 127.0.0.2:8004/metrics | awk '/nv_inference_request_success{/ {print $2}'` + server0_request_count=${server0_request_count:-0} + server1_request_count=${server1_request_count:-0} + server2_request_count=${server2_request_count:-0} + echo "${p} round ${round}: server0=${server0_request_count} server1=${server1_request_count} server2=${server2_request_count}" + if [ ${server0_request_count%.*} -gt 0 ] && \ + [ ${server1_request_count%.*} -gt 0 ] && \ + [ ${server2_request_count%.*} -gt 0 ]; then + break + fi done - wait $pids || { echo -e "\n***\n*** Python ${p} Async Infer Test Failed\n***"; cat $CLIENT_LOG; RET=1; } set -e - server0_request_count=`curl -s localhost:8002/metrics | awk '/nv_inference_request_success{/ {print $2}'` - server1_request_count=`curl -s localhost:8003/metrics | awk '/nv_inference_request_success{/ {print $2}'` - server2_request_count=`curl -s 127.0.0.2:8004/metrics | awk '/nv_inference_request_success{/ {print $2}'` if [ ${server0_request_count%.*} -eq 0 ] || \ [ ${server1_request_count%.*} -eq 0 ] || \ [ ${server2_request_count%.*} -eq 0 ]; then - echo -e "\n***\n*** Failed: ${p} requests are not distributed among all servers.\n***" + echo -e "\n***\n*** Failed: ${p} requests are not distributed among all servers after ${MAX_CLIENT_ROUNDS} rounds.\n***" RET=1 fi kill_servers From 8be490c83e6896a2b789f2f877021788e0fb4346 Mon Sep 17 00:00:00 2001 From: Yingge He Date: Thu, 22 Oct 2026 10:41:05 -0700 Subject: [PATCH 2/2] test: Cap L0_socket reuse-port retries at 3 rounds A third batch makes a chance miss negligible, while a listener that never accepts still fails. Ten rounds only delays that failure. Signed-off-by: Yingge He --- qa/L0_socket/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/L0_socket/test.sh b/qa/L0_socket/test.sh index 8e288a931f..9f89a1703b 100755 --- a/qa/L0_socket/test.sh +++ b/qa/L0_socket/test.sh @@ -391,7 +391,7 @@ for p in http grpc; do # listeners by hashing the client address/port, so a single batch of # clients can miss a server by chance. Keep sending batches until every # server has served a request, up to MAX_CLIENT_ROUNDS. - MAX_CLIENT_ROUNDS=10 + MAX_CLIENT_ROUNDS=3 for round in $(seq 1 $MAX_CLIENT_ROUNDS); do pids=() for i in {0..10}; do