Squash to "selftests: mptcp: get stats just before timing out"
Subsystems (3)
Matthieu Baerts (NGI0)
maintainerPATCH 1/1 Squash to "selftests: mptcp: get stats just before timing out"
Geliang reported that mptcp_connect.sh test runtime got increased after this patch.
That's because the previous 'kill' command was only killing the background job, but the 'sleep' command was still running.
It is not very clear to me why there was a delay at the end, but switching to mptcp_lib_kill_group_wait to kill the background job and the running command fixed the issue. The new code is also looking clearer I think, so that's good.
--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 7 ++++++- tools/testing/selftests/net/mptcp/mptcp_join.sh | 7 ++++++- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 7 ++++++- tools/testing/selftests/net/mptcp/simult_flows.sh | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +6 -1
@@ -415,7 +415,12 @@ do_transfer() local retc=$? wait $spid local rets=$? - kill $timeout_pid 2>/dev/null && timeout_pid=0 + + if kill -0 $timeout_pid; then + # Finished before the timeout: kill the background job + mptcp_lib_kill_group_wait $timeout_pid + timeout_pid=0 + fi local stop stop=$(date +%s%3N)
tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -1
@@ -1063,7 +1063,12 @@ do_transfer() local retc=$? wait $spid local rets=$? - kill $timeout_pid 2>/dev/null && timeout_pid=0 + + if kill -0 $timeout_pid; then + # Finished before the timeout: kill the background job + mptcp_lib_kill_group_wait $timeout_pid + timeout_pid=0 + fi cond_stop_capture
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +6 -1
@@ -193,7 +193,12 @@ do_transfer() local retc=$? wait $spid local rets=$? - kill $timeout_pid 2>/dev/null && timeout_pid=0 + + if kill -0 $timeout_pid; then + # Finished before the timeout: kill the background job + mptcp_lib_kill_group_wait $timeout_pid + timeout_pid=0 + fi mptcp_lib_nstat_get "${listener_ns}" mptcp_lib_nstat_get "${connector_ns}"
tools/testing/selftests/net/mptcp/simult_flows.sh +6 -1
@@ -178,7 +178,12 @@ do_transfer() local retc=$? wait $spid local rets=$? - kill $timeout_pid 2>/dev/null && timeout_pid=0 + + if kill -0 $timeout_pid; then + # Finished before the timeout: kill the background job + mptcp_lib_kill_group_wait $timeout_pid + timeout_pid=0 + fi if $capture; then sleep 1
---
base-commit: 6861f291b7a3bc40235e996f5605c477f55ce9e0
change-id: 20251113-slft-timeout-stats-kill-444931425af7
Best regards,
Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
Hi Matthieu,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/19330080819
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/9a2c02054a5b
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1022917
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Hi Matt,
Thanks for this fix.
Quoted 7 lines · On Thu, 2025-11-13 at 12:11 +0100, Matthieu Baerts (NGI0) wrote:
Geliang reported that
mptcp_connect.shtest runtime got increased after
this patch.That's because the previous 'kill' command was only killing the background job, but the 'sleep' command was still running.
Quoted 8 lines
It is not very clear to me why there was a delay at the end, but switching to
mptcp_lib_kill_group_waitto kill the background job and the running command fixed the issue. The new code is also looking clearer I think, so that's good.Link:
https://lore.kernel.org/[email protected]Signed-off-by Matthieu Baerts (NGI0) <[email protected]>
It works.
-Geliang
Quoted 93 lines
---
tools/testing/selftests/net/mptcp/mptcp_connect.sh | 7 ++++++- tools/testing/selftests/net/mptcp/mptcp_join.sh | 7 ++++++-tools/testing/selftests/net/mptcp/mptcp_sockopt.sh| 7 ++++++- tools/testing/selftests/net/mptcp/simult_flows.sh | 7 ++++++-4 files changed, 24 insertions(+), 4 deletions(-)tools/testing/selftests/net/mptcp/mptcp_connect.sh +0
-0@@ -415,7 +415,12 @@ do_transfer()local retc=$?
wait $spid
local rets=$?tools/testing/selftests/net/mptcp/mptcp_connect.sh +3
-1- kill $timeout_pid 2>/dev/null && timeout_pid=0 + + if kill -0 $timeout_pid; then + # Finished before the timeout: kill the backgroundjob
tools/testing/selftests/net/mptcp/mptcp_connect.sh +3
-0+ mptcp_lib_kill_group_wait $timeout_pid + timeout_pid=0 + fi
local stop
stop=$(date +%s%3N)tools/testing/selftests/net/mptcp/mptcp_join.sh +0
-0@@ -1063,7 +1063,12 @@ do_transfer()local retc=$?
wait $spid
local rets=$?tools/testing/selftests/net/mptcp/mptcp_join.sh +3
-1- kill $timeout_pid 2>/dev/null && timeout_pid=0 + + if kill -0 $timeout_pid; then + # Finished before the timeout: kill the backgroundjob
tools/testing/selftests/net/mptcp/mptcp_join.sh +3
-0+ mptcp_lib_kill_group_wait $timeout_pid + timeout_pid=0 + fi
cond_stop_capturetools/testing/selftests/net/mptcp/mptcp_sockopt.sh +0
-0@@ -193,7 +193,12 @@ do_transfer()local retc=$?
wait $spid
local rets=$?tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +3
-1- kill $timeout_pid 2>/dev/null && timeout_pid=0 + + if kill -0 $timeout_pid; then + # Finished before the timeout: kill the backgroundjob
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +3
-0+ mptcp_lib_kill_group_wait $timeout_pid + timeout_pid=0 + fi
mptcp_lib_nstat_get"${listener_ns}"
mptcp_lib_nstat_get"${connector_ns}"tools/testing/selftests/net/mptcp/simult_flows.sh +0
-0@@ -178,7 +178,12 @@ do_transfer()local retc=$?
wait $spid
local rets=$?tools/testing/selftests/net/mptcp/simult_flows.sh +3
-1- kill $timeout_pid 2>/dev/null && timeout_pid=0 + + if kill -0 $timeout_pid; then + # Finished before the timeout: kill the backgroundjob
tools/testing/selftests/net/mptcp/simult_flows.sh +3
-0+ mptcp_lib_kill_group_wait $timeout_pid + timeout_pid=0 + fi
if $capture; then
sleep 1---
base-commit:6861f291b7a3bc40235e996f5605c477f55ce9e0
change-id: 20251113-slft-timeout-stats-kill-444931425af7Best regards,
Matthieu Baerts
maintainerHi Geliang,
Quoted 17 lines · Geliang Tang
Hi Matt,
Thanks for this fix.
Quoted 12 lines · On Thu, 2025-11-13 at 12:11 +0100, Matthieu Baerts (NGI0) wrote:
Geliang reported that
mptcp_connect.shtest runtime got increased after
this patch.That's because the previous 'kill' command was only killing the background job, but the 'sleep' command was still running.
It is not very clear to me why there was a delay at the end, but switching to
mptcp_lib_kill_group_waitto kill the background job and the running command fixed the issue. The new code is also looking clearer I think, so that's good.
Quoted 7 lines
Quoted 3 lines
Link:
https://lore.kernel.org/[email protected]Signed-off-by Matthieu Baerts (NGI0) <[email protected]>It works.
Reviewed-by Geliang Tang <[email protected]>
Thank you for the review, just applied:
New patches for t/upstream:
- 39266eb8cdba: Squash to "selftests: mptcp: get stats just before timing out"
- Results: 24d7b3380fc2..e804ecd59ca4 (export)
Tests are now in progress:
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.