]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
iotests/151: ensure subprocesses are cleaned up
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 15 Jul 2025 14:30:22 +0000 (15:30 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 16 Sep 2025 20:35:35 +0000 (23:35 +0300)
The iotest 151 creates a bunch of subprocesses, with their stdout
connected to a pipe but never reads any data from them and does
not gurantee the processes are killed on cleanup.

This triggers resource leak warnings from python when the
subprocess.Popen object is garbage collected.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 2b2fb25c2aaf5b2e8172d845db39cc50a951a12e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
tests/qemu-iotests/151

index f2ff9c5dac221649fce15c4da42c97379dc307d9..06ee3585db9045e9890635049b941a651cdea0a3 100755 (executable)
@@ -263,6 +263,11 @@ class TestThrottledWithNbdExportBase(iotests.QMPTestCase):
                         break
                     except subprocess.TimeoutExpired:
                         self.vm.qtest(f'clock_step {1 * 1000 * 1000 * 1000}')
+                try:
+                    p.kill()
+                    p.stdout.close()
+                except:
+                    pass
         except IndexError:
             pass