Skip to content

[bug] iperf3 python hangs after long time throughput test (>120s) : file descriptors redirecting is stuck #75

@rexlim820220

Description

@rexlim820220

execution environment

OS: Linux Ubuntu 20.04.6 LTS
Python: 3.8.10
iperf3 version : 3.1.7 (as Iperf server)
iperf3-python version: 0.1.11 (as Iperf client)

issue description

I wrapped iperf3-python toolkit within my python snippet as a client to connect a running iperf servers on 10.10.50.81:64101.

With the following available options for a Client:

    # Test 1: iperf3 -c 10.10.50.81 -u -t 120 -b 1000m -R -p 64101
    cli = iperf3.Client()
    cli.server_hostname = "10.10.50.81"
    cli.port = 64101
    cli.duration = 120
    cli.protocol = "udp"
    cli.bandwidth = 1000000000
    cli.reverse = True
    cli.blksize = 1250
    result1 = cli.run()
    print("Test 1 result:", result1)

    # Test 2: iperf3 -c 10.10.50.81 -u -t 120 -b 200m -p 64101
    cli.server_hostname = "10.10.50.81"
    cli.port = 64101
    cli.duration = 120
    cli.protocol = "udp"
    cli.bandwidth = 2000000000
    cli.reverse = False
    cli.blksize = 1250    
    result2 = cli.run()
    print("Test 2 result:", result2)

However, it keep hanging on "Test 1 result:" even when Iperf server finish traffic.

To trace the reason, I use python3 -m trace --trace phylax_client.py to tell where my python script is hanging,

and the following is the execution log:

image

You can see that the code hang during iperf3.py(70): os.dup2(pipe_in, 1) # stdout, even though iperf server has already finished throughput.

I think this issue might be related to #50. However, the following trick suggested by @perfecto25 doesn't seems to work for me.

    targets = ['server1', 'server2']
    
    for target in targets:
        client = iperf3.Client()
        ## do iperf stuff
        client = None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions