Context
-
Version of iperf3: 3.16
-
Hardware: N/A
-
Operating system (and distribution, if any): 6.5.0-26-generic # 26~22.04.1-Ubuntu
-
Other relevant information (for example, non-default compilers,
libraries, cross-compiling, etc.): N/A
Bug Report
While doing some testing I would occasionally use the wrong iperf flags/parameters and would terminate the test early rather than waiting for it to run completely.
-
Expected Behavior: Terminating a test early causes the client and server to stop testing. The client cleans up and terminates. The server cleans up and prepares for next test.
-
Actual Behavior: Server segfaults during cleanup
-
Steps to Reproduce
- Simulate a high-ish latency link on the loopback interface:
tc qdisc add dev lo root netem delay 50ms
- Start server:
iperf3 -s
- Start client and terminate test early:
iperf3 -c 127.0.0.1 -t 10 -P 10 or iperf3 -c 127.0.0.1 -t 10 --bidir
- It seems to be a race condition so to have better chances at finding it I'll typically run something like
for i in $(seq 100); do iperf3 -c 127.0.0.1 -t 10 -P 10; done then repeatedly use ctrl-c to kill tests.
- Check server crashed
-
Possible Solution
Adding an assert into the code here shows the root cause. Something like assert(sp->thr != 0);. This would indicate that a NULL values is being passed into pthread_cancel. A possible solution would be a NULL check before attempting to cancel the thread.
-
Other observations
I was not able to reproduce the issue using 3.15 as the server.
Context
Version of iperf3: 3.16
Hardware: N/A
Operating system (and distribution, if any): 6.5.0-26-generic # 26~22.04.1-Ubuntu
Other relevant information (for example, non-default compilers,
libraries, cross-compiling, etc.): N/A
Bug Report
While doing some testing I would occasionally use the wrong iperf flags/parameters and would terminate the test early rather than waiting for it to run completely.
Expected Behavior: Terminating a test early causes the client and server to stop testing. The client cleans up and terminates. The server cleans up and prepares for next test.
Actual Behavior: Server segfaults during cleanup
Steps to Reproduce
tc qdisc add dev lo root netem delay 50msiperf3 -siperf3 -c 127.0.0.1 -t 10 -P 10oriperf3 -c 127.0.0.1 -t 10 --bidirfor i in $(seq 100); do iperf3 -c 127.0.0.1 -t 10 -P 10; donethen repeatedly use ctrl-c to kill tests.Possible Solution
Adding an assert into the code here shows the root cause. Something like
assert(sp->thr != 0);. This would indicate that a NULL values is being passed intopthread_cancel. A possible solution would be a NULL check before attempting to cancel the thread.Other observations
I was not able to reproduce the issue using 3.15 as the server.