esnet / iperf

iperf3: A TCP, UDP, and SCTP network bandwidth measurement tool
Other
6.93k stars 1.28k forks source link

Client parameter `-t -1` has unexpected results #1662

Closed ed-at-protectli closed 6 months ago

ed-at-protectli commented 8 months ago

Context

When I was trying to run iperf3 tests for an indefinite amount of time, I tried the client parameter -t -1 instead of the supported and documented -t 0. Because the tests "ran" and the CLI tool didn't complain about the input, I assumed this was "ok". Furthermore, the test indeed seemed to run "indefinitely" instead of the standard 10. However, the application quits with failure after precisely 38 seconds on my test hardware.

Bug Report

The test would either run indefinitely, or the application would reject the -t -1 parameter.

The test initiates, but will eventually crash.

  1. I simply connect together two NICs (enp1s0 and enp2s0) on the device with an ethernet cable (not going through a switch)
  2. Namespace the NICs so that the data actually flows over the cable and not shortcutting through the kernel:
    
    # In one terminal for the iperf server:
    ip net add iperfserver
    ip link set enp1s0 netns iperfserver
    ip netns exec iperfserver ip address add 169.254.1.1/20 dev enp1s0
    ip netns exec iperfserver ip link set enp1s0 up
    ip netns exec iperfserver iperf3 -s -B 169.254.1.1

In another terminal for the iperf client:

ip net add iperfclient ip link set enp2s0 netns iperfclient ip netns exec iperfclient ip address add 169.254.1.2/20 dev enp2s0 ip netns exec iperfclient ip link set enp2s0 up

3. On the client terminal, run the iperf3 command like so, using `-t -1` or `-t=-1` or `--time -1` or `--time=-1`:

ip netns exec iperfclient iperf3 -c 169.254.1.1 -t -1

4. Observe the results in the server terminal after (in my case) 38 seconds

[ 5] 37.00-38.00 sec 235 Mbytes 1.97 Gbits/sec iperf3: error - select failed: Bad file descriptor

Server listening on 5201

5. Observe the results in the client terminal

[ 5] 37.00-38.00 sec 235 Mbytes 1.97 Gbits/sec 0 1008 KBytes iperf3: error - unable to write to stream socket: Broken pipe root@localhost:~#


6. Re-run the same test but substitute `-t -1` with either `-t 0` or `-t 40` (since mine fails at 38 seconds) and the test will properly conduct without error.

* Possible Solution

Reject clients trying to use `-t -1` or treat it the same as `-t 0`
bmah888 commented 6 months ago

Fixed by #1666. I'm not sure why this issue is still open, so closing it explicitly.