autotest/virt-test — pull request #1098 by lmr (2013-11-22 04:23:53+00:00)
Title: virttest.aexpect: FD leak fixes

Hey guys @Antique, @ruda and @cevich:

After a *long* time today debugging aexpect code, I was able to made a couple of changes that reduced even more the amount of open filedescriptors on a virt-test execution. Those changes are pretty simple, separate and are well tested. For reference, before my patch 964cd064dca5fb8deb2f98672f36431032e3ad79 (the original one, made a while ago), this is what a regular virt-test execution left of open filedescriptors:

29 -> 36 -> 45 -> 53 -> 61 -> 69 -> 77 -> 84 -> 93 -> 101

After the patch, it got better:

26 -> 31 -> 36 -> 41 -> 46 -> 51 -> 56 -> 61 -> 66 -> 71

Which is what we have today. Further patches here reduce it to:

23 -> 25 -> 27 -> 29 -> 31 -> 33 -> 35 -> 37 -> 39 -> 40

And to:

22 -> 23 -> 24 -> 25 -> 26 -> 26 -> 28 -> 29 -> 30 -> 31

Which is the best I could get for today. There's still an issue with an aexpect "expect" thread holding fds, and I haven't figured out a way to close them. At any rate, it's a good 40 fd open less than it is today after a set of 10 migration tests. If you have an idea on how to fix this last problem, let me know.