Open karlism opened 4 years ago
I have that very same error if I use the library twice in he same python script.
client2 = iperf3.Client()
client2.duration=5
client2.server_hostname = "xxx"
client2.reverse=True
print ("testing download...")
result2=client2.run()
print ("DL Sent: " + str(result2.sent_Mbps))
time.sleep(3)
client = iperf3.Client()
client.duration=5
client.server_hostname = "xxx"
print ("testing upload...")
result=client.run()
print ("UL Sent: " + str(result.sent_Mbps))
If will crash on the end of second test, if I run just one direction and create just 1 client then it is fine.
easy way to fix this , just unset the client var
targets = ['server1', 'server2']
for target in targets:
client = iperf3.Client()
## do iperf stuff
client = None
this makes the For loop work
I also encounter the same issue. No matter if client runs in either udp or tcp mode:
Differ from @xsherlockpl's case, I use a multiprocessing to create two threads to the reproduce issue, in which both of the threads mainly run iperf client.
The following shows most recent call trace back log:
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/util.py", line 300, in _run_finalizers
finalizer()
File "/usr/lib/python3.9/multiprocessing/util.py", line 224, in __call__
res = self._callback(*self._args, **self._kwargs)
File "/usr/lib/python3.9/multiprocessing/managers.py", line 874, in _decref
tls.connection.close()
File "/usr/lib/python3.9/multiprocessing/connection.py", line 182, in close
self._close()
File "/usr/lib/python3.9/multiprocessing/connection.py", line 366, in _close
_close(self._handle)
OSError: [Errno 9] Bad file descriptor
It seems that repeatedly create iperf3.Client()
object will raise this problem due to the library's own pitfall.
Running following code, based mostly on this example produces error:
Same issue experienced with UDP client example. It always fails on second iteration of the test. Additional details about test environment:
Any ideas why it fails?