thiezn / iperf3-python

Python wrapper around iperf3
https://iperf3-python.readthedocs.org/
MIT License
109 stars 52 forks source link

iperf3 stops working after a while #61

Open Booleanac opened 3 years ago

Booleanac commented 3 years ago

Hello,

Let me explain the situation. I have a server that periodically sends commands to a bunch of clients (I have written the client and the server code), when the command is sent, the clients perform an iperf test. The server runs iperf3 servers is separate processes (no python here, just plain terminal window). So the server is fine. The client is using asyncio to run the code that accepts commands and then runs iper3 test. This works find for a while, but after a week or so, iper3 no longer runs any test. Here is the code for running the iper3 test:

MyFunction(protocol,duration,port): client=iperf3.Client() client.duration=int(duration) client.port=port client.bind_port=17801 client.server_hostname='IP address of the server machine' client.protocol=protocol client.reverse=True a=client.run() return a

The current parameter, with which the software runs fine for a while, are - protocol TCP, duration 10. What happens is after a while, this code does not initiate a test. I can see whether a test is being run on the iperf server, and nothing happens. Not even an initiation of a connection. I can verify the code is running on the client as I have remote access to these client boxes. I use as px and I see the process running. On the same client box, where the script is failing, if I run the iperf3 test from the terminal it works fine, and I can see the test on the server as well. I used strace on the process, and I get the following exception:

image

This is inline with client.run() not running the test for some reason. The function above is run by asyncio that is run in the main thread. I am going to continue troubleshooting, but it would be great if you can help me.

OS-CentOS Linux 7 (Core) Python3 version Python 3.6.8

nujo commented 3 years ago

Seems I have the same issue, same os and python version. I've found that after ~12hrs tests stop running and this close_wait status stays forever


[user@vm1~]$ lsof -aP -i4 -i6 -itcp | grep 5201
python3  28741 user1022u  IPv4 4585541      0t0  TCP vm1:53334->vm2:5201 (CLOSE_WAIT)
Sheng2216 commented 2 years ago

I had the same issue on a raspberry pi 4b+ as the client, and it won't print out the result after running for more than 100s, has anyone figured out how to fix this issue?

tditri commented 2 years ago

I am also having the same issue with the client. After running for more than a 100s, it hangs.

heath13 commented 2 years ago

I have found that if I include client.json_output = True client.duration = 100 Then Iperf3 hangs after the test is performed.

If I remove "client.json_output = True" the Iperf3 test will work for duration 100s