Skip to content

Server hangs endlessly (0.00 Mbits/sec) on sudden client disconnect – Works in 3.14, broken in 3.16+ #1986

Open

Description

@Vili-B

iperf3 Version(s)

Working: 3.14

Intermittent: 3.15

Broken: 3.16 and newer

Operating System / Architecture

Server: Alma Linux 10
Client: Android

Defect Description

I am encountering a regression in how iperf3 handles sudden client disconnections (specifically with mobile devices losing signal).

When a client device (mobile) abruptly loses connection during a test (e.g., 4G/5G drops or is toggled off), the server instance should detect the loss, report "Connection reset by peer," and return to the listening state.

In versions 3.16 and newer, the server fails to detect the disconnect. Instead of resetting, it hangs indefinitely, printing 0.00 Mbits/sec lines until manually killed.

Regression / Bisect Info

I have tested multiple versions to isolate the behavior:

v3.14: Works reliably. The server detects the drop immediately, prints iperf3: error - unable to read from stream socket: Connection reset by peer, and waits for a new client.

v3.15: Unreliable. It works sometimes, but occasionally exhibits the hanging behavior.

v3.16+ (up to current): consistently broken. The server never resets and hangs on 0.00 Mbits/sec until the process is killed.

Steps to Reproduce

Start an iperf3 server: iperf3 -s

Connect a client (a mobile device over 4G or 5G): iperf3 -c <server_ip> -t 100

Midway through the test, simulate a signal loss on the client (e.g., disable 4G/5G data or toggle airplane mode).

Observe Server Output:

Expected (v3.14): Server errors out with "Connection reset" and restarts the listener.

Actual (v3.16+): Server continues running, printing 0.00 Mbits/sec indefinitely.

Activity

  1. davidBar-On commented on Dec 18, 2025

    @davidBar-On
    Contributor

    @Vili-B, can you try running the server with --rcv-timeout option to see if it helps. E.g. setting --rcv-timeout 10 should stop the server about 10 seconds after the "signal loss". Note that for backward compatibility the default is no receive timeout.

    (Even if --rcv-timeout solve the problem, it is probably only a workaround, as I guess the server's receiving thread is terminated. However, currently the main thread of iperf does not detect termination of sending/receiving threads. E.g. see PR #1654.)

  2. WatcherOfTheSkies commented on Dec 19, 2025

    @WatcherOfTheSkies
    Contributor

    Do you mean --rcv-timeout?

    It's default is 120 sec, and range 100sec to 1 day!

  3. davidBar-On commented on Dec 19, 2025

    @davidBar-On
    Contributor

    It's default is 120 sec, and range 100sec to 1 day!

    You are right. Sorry for the confusion. In this case, did you wait the 120 sec after the signal loss and the server still didn't stop the test? Can you try setting the --rcv-timeout manually to shorter time (e.g. 10 sec) and see if it also doesn't cause the test to stop?

    Midway through the test, simulate a signal loss on the client (e.g., disable 4G/5G data or toggle airplane mode).

    I have tried that by code changes (I don't have proper test environment for mobile) - stopping sending data from the client in the middle of the test and then also terminating the sending thread at that point. In both cases, the server terminated the test after the --rcv-timeout timed out (I set it to 5 seconds and set client test time to -t 20, but that was the same with the default 120 sec receive timeout with -t200).

    Also, I evaluated the iperf3 code and didn't find a case were no data is received and the --rcv-timeout timeout does not cause the server to terminate the test.

  4. Vili-B commented on Dec 19, 2025

    @Vili-B
    Author

    Yes I have waited for the 2 minute default mark and tried to change the --rcv-timeout to 5 sec or 10 sec but neither works, it just keeps showing 0 until manually stopped.

  5. davidBar-On commented on Dec 19, 2025

    @davidBar-On
    Contributor

    Can you run the server using -V --debug=3 options? Main purpose is to see the "State change: State set to ..." messages , which may indicate whether the server did identify the test termination condition, and is stuck because it sent a control message to the client and is waiting for a response or something like that.

    Alternatively (or in addition), if you are able to build iperf3 can you try building and testing using the code of PR #1764? Although it is the same test scenario, the issue seems to be similar, so it may be that the PR change solves also this problem.

  6. Vili-B commented on Dec 19, 2025

    @Vili-B
    Author

    I ran the server with the -V --debug=3 plus --rcv-timeout with 5 secodns below there are the logs, client was put to airplane mode at the 5 second mark.

    tcpi_snd_cwnd 156 tcpi_snd_mss 1388 tcpi_rtt 122769
    tcpi_snd_cwnd 162 tcpi_snd_mss 1388 tcpi_rtt 123509
    tcpi_snd_cwnd 480 tcpi_snd_mss 1388 tcpi_rtt 120334
    tcpi_snd_cwnd 220 tcpi_snd_mss 1388 tcpi_rtt 119420
    interval_len 1.001132 bytes_transferred 2228224
    interval forces keep
    interval_len 1.001149 bytes_transferred 1966080
    interval forces keep
    interval_len 1.001151 bytes_transferred 5767168
    interval forces keep
    interval_len 1.001157 bytes_transferred 3407872
    interval forces keep
    [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
    [  5]   0.00-1.00   sec  2.12 MBytes  17.8 Mbits/sec    0    211 KBytes
    [  8]   0.00-1.00   sec  1.88 MBytes  15.7 Mbits/sec    0    220 KBytes
    [ 10]   0.00-1.00   sec  5.50 MBytes  46.1 Mbits/sec    0    651 KBytes
    [ 12]   0.00-1.00   sec  3.25 MBytes  27.2 Mbits/sec    0    298 KBytes
    [SUM]   0.00-1.00   sec  12.8 MBytes   107 Mbits/sec    0
    tcpi_snd_cwnd 156 tcpi_snd_mss 1388 tcpi_rtt 82562
    tcpi_snd_cwnd 124 tcpi_snd_mss 1388 tcpi_rtt 82660
    tcpi_snd_cwnd 452 tcpi_snd_mss 1388 tcpi_rtt 80312
    tcpi_snd_cwnd 258 tcpi_snd_mss 1388 tcpi_rtt 84676
    interval_len 0.999988 bytes_transferred 2228224
    interval forces keep
    interval_len 0.999987 bytes_transferred 1572864
    interval forces keep
    interval_len 0.999988 bytes_transferred 6029312
    interval forces keep
    interval_len 0.999984 bytes_transferred 3932160
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   1.00-2.00   sec  2.12 MBytes  17.8 Mbits/sec    0    211 KBytes
    [  8]   1.00-2.00   sec  1.50 MBytes  12.6 Mbits/sec    0    168 KBytes
    [ 10]   1.00-2.00   sec  5.75 MBytes  48.2 Mbits/sec    0    613 KBytes
    [ 12]   1.00-2.00   sec  3.75 MBytes  31.5 Mbits/sec    0    350 KBytes
    [SUM]   1.00-2.00   sec  13.1 MBytes   110 Mbits/sec    0
    tcpi_snd_cwnd 134 tcpi_snd_mss 1388 tcpi_rtt 47345
    tcpi_snd_cwnd 92 tcpi_snd_mss 1388 tcpi_rtt 49470
    tcpi_snd_cwnd 304 tcpi_snd_mss 1388 tcpi_rtt 46296
    tcpi_snd_cwnd 212 tcpi_snd_mss 1388 tcpi_rtt 45707
    interval_len 0.999987 bytes_transferred 2228224
    interval forces keep
    interval_len 0.999988 bytes_transferred 1572864
    interval forces keep
    interval_len 0.999987 bytes_transferred 6029312
    interval forces keep
    interval_len 0.999987 bytes_transferred 3145728
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   2.00-3.00   sec  2.12 MBytes  17.8 Mbits/sec    0    182 KBytes
    [  8]   2.00-3.00   sec  1.50 MBytes  12.6 Mbits/sec    0    125 KBytes
    [ 10]   2.00-3.00   sec  5.75 MBytes  48.2 Mbits/sec    0    412 KBytes
    [ 12]   2.00-3.00   sec  3.00 MBytes  25.2 Mbits/sec    0    287 KBytes
    [SUM]   2.00-3.00   sec  12.4 MBytes   104 Mbits/sec    0
    tcpi_snd_cwnd 154 tcpi_snd_mss 1388 tcpi_rtt 34745
    tcpi_snd_cwnd 118 tcpi_snd_mss 1388 tcpi_rtt 36352
    tcpi_snd_cwnd 406 tcpi_snd_mss 1388 tcpi_rtt 32142
    tcpi_snd_cwnd 220 tcpi_snd_mss 1388 tcpi_rtt 32297
    interval_len 0.999998 bytes_transferred 2752512
    interval forces keep
    interval_len 0.999998 bytes_transferred 2359296
    interval forces keep
    interval_len 0.999998 bytes_transferred 8519680
    interval forces keep
    interval_len 0.999998 bytes_transferred 3932160
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   3.00-4.00   sec  2.62 MBytes  22.0 Mbits/sec    0    209 KBytes
    [  8]   3.00-4.00   sec  2.25 MBytes  18.9 Mbits/sec    0    160 KBytes
    [ 10]   3.00-4.00   sec  8.12 MBytes  68.2 Mbits/sec    0    550 KBytes
    [ 12]   3.00-4.00   sec  3.75 MBytes  31.5 Mbits/sec    0    298 KBytes
    [SUM]   3.00-4.00   sec  16.8 MBytes   141 Mbits/sec    0
    tcpi_snd_cwnd 150 tcpi_snd_mss 1388 tcpi_rtt 114692
    tcpi_snd_cwnd 126 tcpi_snd_mss 1388 tcpi_rtt 113781
    tcpi_snd_cwnd 512 tcpi_snd_mss 1388 tcpi_rtt 113058
    tcpi_snd_cwnd 242 tcpi_snd_mss 1388 tcpi_rtt 111082
    interval_len 1.000038 bytes_transferred 1703936
    interval forces keep
    interval_len 1.000034 bytes_transferred 1179648
    interval forces keep
    interval_len 1.000035 bytes_transferred 4980736
    interval forces keep
    interval_len 1.000035 bytes_transferred 2621440
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   4.00-5.00   sec  1.62 MBytes  13.6 Mbits/sec    0    203 KBytes
    [  8]   4.00-5.00   sec  1.12 MBytes  9.44 Mbits/sec    0    171 KBytes
    [ 10]   4.00-5.00   sec  4.75 MBytes  39.8 Mbits/sec    0    694 KBytes
    [ 12]   4.00-5.00   sec  2.50 MBytes  21.0 Mbits/sec    0    328 KBytes
    [SUM]   4.00-5.00   sec  10.0 MBytes  83.9 Mbits/sec    0
    tcpi_snd_cwnd 122 tcpi_snd_mss 1388 tcpi_rtt 83309
    tcpi_snd_cwnd 104 tcpi_snd_mss 1388 tcpi_rtt 85427
    tcpi_snd_cwnd 498 tcpi_snd_mss 1388 tcpi_rtt 84482
    tcpi_snd_cwnd 204 tcpi_snd_mss 1388 tcpi_rtt 79777
    interval_len 0.999984 bytes_transferred 1441792
    interval forces keep
    interval_len 0.999989 bytes_transferred 1310720
    interval forces keep
    interval_len 0.999989 bytes_transferred 3932160
    interval forces keep
    interval_len 0.999990 bytes_transferred 2490368
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   5.00-6.00   sec  1.38 MBytes  11.5 Mbits/sec    0    165 KBytes
    [  8]   5.00-6.00   sec  1.25 MBytes  10.5 Mbits/sec    0    141 KBytes
    [ 10]   5.00-6.00   sec  3.75 MBytes  31.5 Mbits/sec    0    675 KBytes
    [ 12]   5.00-6.00   sec  2.38 MBytes  19.9 Mbits/sec    0    277 KBytes
    [SUM]   5.00-6.00   sec  8.75 MBytes  73.4 Mbits/sec    0
    tcpi_snd_cwnd 122 tcpi_snd_mss 1388 tcpi_rtt 83309
    tcpi_snd_cwnd 104 tcpi_snd_mss 1388 tcpi_rtt 85427
    tcpi_snd_cwnd 498 tcpi_snd_mss 1388 tcpi_rtt 84482
    tcpi_snd_cwnd 204 tcpi_snd_mss 1388 tcpi_rtt 79777
    interval_len 1.000009 bytes_transferred 0
    interval forces keep
    interval_len 1.000005 bytes_transferred 0
    interval forces keep
    interval_len 1.000004 bytes_transferred 0
    interval forces keep
    interval_len 1.000004 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0    165 KBytes
    [  8]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0    141 KBytes
    [ 10]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0    675 KBytes
    [ 12]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0    277 KBytes
    [SUM]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 122 tcpi_snd_mss 1388 tcpi_rtt 83309
    tcpi_snd_cwnd 104 tcpi_snd_mss 1388 tcpi_rtt 85427
    tcpi_snd_cwnd 498 tcpi_snd_mss 1388 tcpi_rtt 84482
    tcpi_snd_cwnd 204 tcpi_snd_mss 1388 tcpi_rtt 79777
    interval_len 1.000000 bytes_transferred 0
    interval forces keep
    interval_len 1.000003 bytes_transferred 0
    interval forces keep
    interval_len 1.000003 bytes_transferred 0
    interval forces keep
    interval_len 1.000002 bytes_transferred 0
    interval forces keep```
    
  7. davidBar-On commented on Dec 19, 2025

    @davidBar-On
    Contributor

    Thanks for running the test. I don't see anything that can help in the logs.
    Can you re-run the test and send the server logs for 15 seconds (instead of 7)? The reason I am asking if that is the client was put into airplane mode after 5 seconds and the receive timeout is 5 seconds, then the server receive timeout should be triggered only at about second 10 of the test (the 15 is just to make usre, in case the trigger is not exactly at the 10's second).

  8. Vili-B commented on Dec 19, 2025

    @Vili-B
    Author

    Good point! The test was run exactly the same as previously.

    All threads created
    tcpi_snd_cwnd 58 tcpi_snd_mss 1388 tcpi_rtt 79656
    tcpi_snd_cwnd 120 tcpi_snd_mss 1388 tcpi_rtt 68582
    tcpi_snd_cwnd 155 tcpi_snd_mss 1388 tcpi_rtt 76000
    tcpi_snd_cwnd 233 tcpi_snd_mss 1388 tcpi_rtt 71799
    interval_len 1.000304 bytes_transferred 786432
    interval forces keep
    interval_len 1.000328 bytes_transferred 1441792
    interval forces keep
    interval_len 1.000330 bytes_transferred 1835008
    interval forces keep
    interval_len 1.000337 bytes_transferred 2621440
    interval forces keep
    [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
    [  5]   0.00-1.00   sec   768 KBytes  6.29 Mbits/sec    0   78.6 KBytes
    [  8]   0.00-1.00   sec  1.38 MBytes  11.5 Mbits/sec    0    163 KBytes
    [ 10]   0.00-1.00   sec  1.75 MBytes  14.7 Mbits/sec    0    210 KBytes
    [ 12]   0.00-1.00   sec  2.50 MBytes  21.0 Mbits/sec    0    316 KBytes
    [SUM]   0.00-1.00   sec  6.38 MBytes  53.5 Mbits/sec    0
    tcpi_snd_cwnd 130 tcpi_snd_mss 1388 tcpi_rtt 64997
    tcpi_snd_cwnd 166 tcpi_snd_mss 1388 tcpi_rtt 65193
    tcpi_snd_cwnd 200 tcpi_snd_mss 1388 tcpi_rtt 61364
    tcpi_snd_cwnd 306 tcpi_snd_mss 1388 tcpi_rtt 62249
    interval_len 1.000759 bytes_transferred 1703936
    interval forces keep
    interval_len 1.000749 bytes_transferred 1703936
    interval forces keep
    interval_len 1.000750 bytes_transferred 2359296
    interval forces keep
    interval_len 1.000745 bytes_transferred 4456448
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   1.00-2.00   sec  1.62 MBytes  13.6 Mbits/sec    0    176 KBytes
    [  8]   1.00-2.00   sec  1.62 MBytes  13.6 Mbits/sec    0    225 KBytes
    [ 10]   1.00-2.00   sec  2.25 MBytes  18.9 Mbits/sec    0    271 KBytes
    [ 12]   1.00-2.00   sec  4.25 MBytes  35.6 Mbits/sec    0    415 KBytes
    [SUM]   1.00-2.00   sec  9.75 MBytes  81.7 Mbits/sec    0
    tcpi_snd_cwnd 136 tcpi_snd_mss 1388 tcpi_rtt 65830
    tcpi_snd_cwnd 194 tcpi_snd_mss 1388 tcpi_rtt 65942
    tcpi_snd_cwnd 208 tcpi_snd_mss 1388 tcpi_rtt 64469
    tcpi_snd_cwnd 324 tcpi_snd_mss 1388 tcpi_rtt 64437
    interval_len 0.999135 bytes_transferred 1835008
    interval forces keep
    interval_len 0.999140 bytes_transferred 2621440
    interval forces keep
    interval_len 0.999140 bytes_transferred 3014656
    interval forces keep
    interval_len 0.999142 bytes_transferred 3538944
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   2.00-3.00   sec  1.75 MBytes  14.7 Mbits/sec    0    184 KBytes
    [  8]   2.00-3.00   sec  2.50 MBytes  21.0 Mbits/sec    0    263 KBytes
    [ 10]   2.00-3.00   sec  2.88 MBytes  24.1 Mbits/sec    0    282 KBytes
    [ 12]   2.00-3.00   sec  3.38 MBytes  28.3 Mbits/sec    0    439 KBytes
    [SUM]   2.00-3.00   sec  10.5 MBytes  88.2 Mbits/sec    0
    tcpi_snd_cwnd 180 tcpi_snd_mss 1388 tcpi_rtt 99956
    tcpi_snd_cwnd 262 tcpi_snd_mss 1388 tcpi_rtt 98512
    tcpi_snd_cwnd 250 tcpi_snd_mss 1388 tcpi_rtt 98608
    tcpi_snd_cwnd 426 tcpi_snd_mss 1388 tcpi_rtt 101204
    interval_len 1.000917 bytes_transferred 1703936
    interval forces keep
    interval_len 1.000911 bytes_transferred 2228224
    interval forces keep
    interval_len 1.000911 bytes_transferred 1835008
    interval forces keep
    interval_len 1.000909 bytes_transferred 3801088
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   3.00-4.00   sec  1.62 MBytes  13.6 Mbits/sec    0    244 KBytes
    [  8]   3.00-4.00   sec  2.12 MBytes  17.8 Mbits/sec    0    355 KBytes
    [ 10]   3.00-4.00   sec  1.75 MBytes  14.7 Mbits/sec    0    339 KBytes
    [ 12]   3.00-4.00   sec  3.62 MBytes  30.4 Mbits/sec    0    577 KBytes
    [SUM]   3.00-4.00   sec  9.12 MBytes  76.5 Mbits/sec    0
    tcpi_snd_cwnd 220 tcpi_snd_mss 1388 tcpi_rtt 71986
    tcpi_snd_cwnd 318 tcpi_snd_mss 1388 tcpi_rtt 72199
    tcpi_snd_cwnd 262 tcpi_snd_mss 1388 tcpi_rtt 69590
    tcpi_snd_cwnd 464 tcpi_snd_mss 1388 tcpi_rtt 73209
    interval_len 0.999082 bytes_transferred 2097152
    interval forces keep
    interval_len 0.999082 bytes_transferred 3014656
    interval forces keep
    interval_len 0.999082 bytes_transferred 3407872
    interval forces keep
    interval_len 0.999082 bytes_transferred 4980736
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   4.00-5.00   sec  2.00 MBytes  16.8 Mbits/sec    0    298 KBytes
    [  8]   4.00-5.00   sec  2.88 MBytes  24.1 Mbits/sec    0    431 KBytes
    [ 10]   4.00-5.00   sec  3.25 MBytes  27.3 Mbits/sec    0    355 KBytes
    [ 12]   4.00-5.00   sec  4.75 MBytes  39.9 Mbits/sec    0    629 KBytes
    [SUM]   4.00-5.00   sec  12.9 MBytes   108 Mbits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 1.000125 bytes_transferred 1179648
    interval forces keep
    interval_len 1.000139 bytes_transferred 1572864
    interval forces keep
    interval_len 1.000139 bytes_transferred 1310720
    interval forces keep
    interval_len 1.000139 bytes_transferred 2490368
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   5.00-6.00   sec  1.12 MBytes  9.44 Mbits/sec    0    266 KBytes
    [  8]   5.00-6.00   sec  1.50 MBytes  12.6 Mbits/sec    0    401 KBytes
    [ 10]   5.00-6.00   sec  1.25 MBytes  10.5 Mbits/sec    0    323 KBytes
    [ 12]   5.00-6.00   sec  2.38 MBytes  19.9 Mbits/sec    0    591 KBytes
    [SUM]   5.00-6.00   sec  6.25 MBytes  52.4 Mbits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 1.000038 bytes_transferred 0
    interval forces keep
    interval_len 1.000024 bytes_transferred 0
    interval forces keep
    interval_len 1.000024 bytes_transferred 0
    interval forces keep
    interval_len 1.000024 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 1.000008 bytes_transferred 0
    interval forces keep
    interval_len 1.000008 bytes_transferred 0
    interval forces keep
    interval_len 1.000008 bytes_transferred 0
    interval forces keep
    interval_len 1.000008 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 0.999978 bytes_transferred 0
    interval forces keep
    interval_len 0.999990 bytes_transferred 0
    interval forces keep
    interval_len 0.999990 bytes_transferred 0
    interval forces keep
    interval_len 0.999990 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   8.00-9.00   sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]   8.00-9.00   sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]   8.00-9.00   sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]   8.00-9.00   sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]   8.00-9.00   sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 0.999978 bytes_transferred 0
    interval forces keep
    interval_len 0.999981 bytes_transferred 0
    interval forces keep
    interval_len 0.999981 bytes_transferred 0
    interval forces keep
    interval_len 0.999981 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]   9.00-10.00  sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]   9.00-10.00  sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]   9.00-10.00  sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]   9.00-10.00  sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]   9.00-10.00  sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 0.999914 bytes_transferred 0
    interval forces keep
    interval_len 0.999900 bytes_transferred 0
    interval forces keep
    interval_len 0.999899 bytes_transferred 0
    interval forces keep
    interval_len 0.999902 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]  10.00-11.00  sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]  10.00-11.00  sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]  10.00-11.00  sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]  10.00-11.00  sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]  10.00-11.00  sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 1.000085 bytes_transferred 0
    interval forces keep
    interval_len 1.000098 bytes_transferred 0
    interval forces keep
    interval_len 1.000098 bytes_transferred 0
    interval forces keep
    interval_len 1.000095 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]  11.00-12.00  sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]  11.00-12.00  sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]  11.00-12.00  sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]  11.00-12.00  sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]  11.00-12.00  sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 1.000014 bytes_transferred 0
    interval forces keep
    interval_len 1.000014 bytes_transferred 0
    interval forces keep
    interval_len 1.000014 bytes_transferred 0
    interval forces keep
    interval_len 1.000014 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]  12.00-13.00  sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]  12.00-13.00  sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]  12.00-13.00  sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]  12.00-13.00  sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]  12.00-13.00  sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 0.999991 bytes_transferred 0
    interval forces keep
    interval_len 0.999978 bytes_transferred 0
    interval forces keep
    interval_len 0.999978 bytes_transferred 0
    interval forces keep
    interval_len 0.999979 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]  13.00-14.00  sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]  13.00-14.00  sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]  13.00-14.00  sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]  13.00-14.00  sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]  13.00-14.00  sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 0.999998 bytes_transferred 0
    interval forces keep
    interval_len 1.000012 bytes_transferred 0
    interval forces keep
    interval_len 1.000012 bytes_transferred 0
    interval forces keep
    interval_len 1.000012 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]  14.00-15.00  sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]  14.00-15.00  sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]  14.00-15.00  sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]  14.00-15.00  sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]  14.00-15.00  sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 1.000034 bytes_transferred 0
    interval forces keep
    interval_len 1.000018 bytes_transferred 0
    interval forces keep
    interval_len 1.000019 bytes_transferred 0
    interval forces keep
    interval_len 1.000018 bytes_transferred 0
    interval forces keep
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [  5]  15.00-16.00  sec  0.00 Bytes  0.00 bits/sec    0    266 KBytes
    [  8]  15.00-16.00  sec  0.00 Bytes  0.00 bits/sec    0    401 KBytes
    [ 10]  15.00-16.00  sec  0.00 Bytes  0.00 bits/sec    0    323 KBytes
    [ 12]  15.00-16.00  sec  0.00 Bytes  0.00 bits/sec    0    591 KBytes
    [SUM]  15.00-16.00  sec  0.00 Bytes  0.00 bits/sec    0
    tcpi_snd_cwnd 196 tcpi_snd_mss 1388 tcpi_rtt 70334
    tcpi_snd_cwnd 296 tcpi_snd_mss 1388 tcpi_rtt 70842
    tcpi_snd_cwnd 238 tcpi_snd_mss 1388 tcpi_rtt 70186
    tcpi_snd_cwnd 436 tcpi_snd_mss 1388 tcpi_rtt 70262
    interval_len 0.999979 bytes_transferred 0
    interval forces keep
    interval_len 0.999981 bytes_transferred 0
    interval forces keep
    interval_len 0.999981 bytes_transferred 0
    interval forces keep
    interval_len 0.999994 bytes_transferred 0
    interval forces keep```
    
  9. bmah888 commented on Dec 19, 2025

    @bmah888
    Contributor

    Thanks for the issue report! I fixed up some of the pasted program output in a couple comments to make them easier to read.

  10. bmah888 commented on Dec 19, 2025

    @bmah888
    Contributor

    @Vili-B, any chance you could try running with some newer code (latest released version is 3.20)? I'm pretty sure we did some changes to some timeouts, etc. in the code after 3.16.

    We just started looking at this. I did just a couple of iperf3 tests with VMs (server FreeBSD 14, client Ubuntu 22), where I killed the VM running the client side in the middle of the test (to simulate an ungraceful loss of connectivity). The server continued to run the test for approximately another 50 seconds until it emitted iperf3: error - select failed: Bad file descriptor, terminated the test, and set up for another client connection. This is (roughly) what we'd expect to see.

  11. Vili-B commented on Dec 19, 2025

    @Vili-B
    Author

    Those tests are run with the new 3.20 which I compiled to a debian 12 server. I also let the server idle after dropping the connection and it still continued to show 0mbps at 2700 seconds.

  12. davidBar-On commented on Dec 20, 2025

    @davidBar-On
    Contributor

    Those tests are run with the new 3.20 which I compiled to a debian 12 server. I also let the server idle after dropping the connection and it still continued to show 0mbps at 2700 seconds.

    Can you send the iperf3 commands you are using for both the client and server? E.g. I see that the test runs with 4 streams (-P 4) which is not mentioned in the description. Also, can you send the server version information (iperf3 -v)?

    In any case, it is not clear why the server's receive timeout has no effect or why the server does not terminate the test (or even crash as in my simulation case) 40 seconds after the planned time for the test completion (10+40=50 seconds by default, 100+40 in your test?).

  13. Vili-B commented on Dec 20, 2025

    @Vili-B
    Author

    Server: iperf3 --server -p 22020 --rcv-timeout 5000 -V --debug=3
    Client: iperf3 -c <address> -p 22020 -t 0 -P 4 -R

    iperf 3.20+ (cJSON 1.7.15) Linux docker 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64 Optional features available: CPU affinity setting, IPv6 flow label, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing, authentication, bind to device, support IPv4 don't fragment, POSIX threads

  14. davidBar-On commented on Dec 21, 2025

    @davidBar-On
    Contributor

    Client: iperf3 -c <address> -p 22020 -t 0 -P 4 -R

    As this is a reverse (-R) test, the server is the sender, the --rcv-timeout has not effect. Also, because the test time is unlimited (-t 0), the server will not terminate because the test time expired. In this case, can you try each of the following tests separately to see which mechanism helps:

    1. Limit the test time, e.g. -t 60. In this case the server should terminate the test after 100 seconds of testing (60+40, the equivalent to the 50 seconds @bmah888 mentioned above).
    2. At the server side, set the control channel keep alive with relatively short time, e.g. --cntl-ka=5/4/3. In this case the server is expected to terminate the test 5+(4*3)=17 seconds after the disconnection from the client.
    3. At the server side, set send timeout, e.g. --snd-timeout 5000. If that helps, the server will disconnect the test 5 seconds after the disconnection from the client.
  15. Vili-B commented on Dec 22, 2025

    @Vili-B
    Author

    Limiting the test time works, the server starts waiting for a new client after a few seconds. but it is not the intended way for my case. The send timeout does not work. The control channel keep alive seems to work, but I wonder if this is the intended way but for now it will patch the issue for my case.

  16. davidBar-On commented on Dec 22, 2025

    @davidBar-On
    Contributor

    @Vili-B thanks for testing all the options.. You are right that this was not the intended use case for the keep alive. Its main use case is to make sure that the control socket is not terminated during the text by Proxy / High-availability server / etc., as during the test there are no control messages over this socket. A better approach is probably that the main thread will be aware that sockets are disconnected or that data threads fail (as PR #1654 suggests).

  17. bmah888 commented on May 15, 2026

    @bmah888
    Contributor

    I've been banging away on this problem trying to understand exactly what's going on. I think I've been able to reproduce it with two VMs running under UTM on my macOS 26 laptop. The reason for using VMs is to have control over the simulated state of the physical machine.

    • Server: Ubuntu 26.04 workstation arm64
    • Client: FreeBSD 15.0-RELEASE arm64
    • Start the server with --server plus other options as below.
    • Start the client with iperf3 --client 192.168.64.8 -t 0 -R (192.168.64.8 is the IPv4 address of the server)
    • Pause the client VM to simulate a loss of connectivity

    Results vary depending on the server arguments:

    • With just --server (no other arguments), the server side never terminates, although it will if the client VM is resumed.
    • With --server --cntl-ka=15/4/3 the server will terminate about 15-20 seconds after the client VM is paused. This works roughly as I would have expected.
    • With --server --snd-timeout=5000 the server never terminates, it appears this option has no effect on this case. I didn't expect this.

    @davidBar-On suggested PR #1654 as a possible solution (I think). It touches quite a few files and it also can't apply cleanly to master due to code changes on that codeline since the PR was submitted. I haven't studied this in-depth.

  18. davidBar-On commented on May 16, 2026

    @davidBar-On
    Contributor

    With --server --snd-timeout=5000 the server never terminates, it appears this option has no effect on this case. I didn't expect this.

    I believe that the --snd-timeout does help and it causes the sending thread to terminate. However, the server's main thread is not aware of this termination and also it is not waiting for any response from the client (unless --cntl-ka is set), so the main thread is not terminated in this case.

    Merging PR #1861 (rebased now), that adds error message in case a thread is terminated, can help verifying whether this is the case (adding such error message is helpful in any case).

    ... PR #1654 as a possible solution (I think). It touches quite a few files and it also can't apply cleanly to master due to code changes ...

    I have rebase now PR #1654 to the latest master. The PR changes should cause the master thread to terminate when one of the worker threads is terminated. That should resolve this issue if the the sending thread does terminate.

    I am aware that PR #1654 usage of a counter to determine whether a worker thread was terminated requires careful testing. However, I was not able to find an easier mechanism to allow the master thread to know whether a worker thread was terminated. In general, I believe that such mechanism, to terminate the master thread when a worker thread terminats, is important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions