thiezn / iperf3-python

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

pipes and fds not closed on IPerf3.__del__() #16

Closed p0intR closed 7 years ago

p0intR commented 7 years ago

This should fix resource leaks on file descriptors.

This fixed the IOError: [Errno 24] Too many open files I'm getting while running repeated client tests using this module.

Further, there's also a resource leak in libiperf. I've added a pull request for that, see https://github.com/esnet/iperf/pull/597.

Here's a simple test:

#!/usr/bin/env python3

import iperf3

counter=0

def test():
    client = iperf3.Client()
    client.duration = 1
    client.server_hostname = '127.0.0.1'
    client.port = 5201
    result = client.run()

    if result.error:
        print(result.error)
    else:
        print('{0} Test completed (MB/s: {1})'.format(counter, result.sent_MB_s))

while True:
    test()
    counter+=1
thiezn commented 7 years ago

Uploaded new release to PyPi, install with pip install iperf3. Thanks again @p0intR

bmah888 commented 7 years ago

Just for the record, I've merged esnet/iperf#597.