From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Because command popen created without close parent fds,
it may cause various bugs in execution. when running testcases
test_mock_storagepool, because fds are still open in child process,
following error will print out when command execution:
rc: 5 error: File descriptor 4 (socket:[776684]) leaked on vgdisplay invocation. Parent
PID 13122: python
File descriptor 5 (socket:[777857]) leaked on vgdisplay invocation. Parent PID 13122:
python
File descriptor 6 (/dev/null) leaked on vgdisplay invocation. Parent PID 13122: python
File descriptor 8 (/dev/null) leaked on vgdisplay invocation. Parent PID 13122: python
File descriptor 10 (/dev/null) leaked on vgdisplay invocation. Parent PID 13122: python
File descriptor 11 (/dev/null) leaked on vgdisplay invocation. Parent PID 13122: python
Volume group name "kīмсhīUnitTestLogicalPool" has invalid characters.
Cannot process volume group kīмсhīUnitTestLogicalPool
returned from cmd: vgdisplay kīмсhīUnitTestLogicalPool
Fix this bug by forcing close fds when popen execution.
REF:
http://bugs.python.org/issue7213
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/utils.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index 4b08112..95babe0 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -193,7 +193,7 @@ def run_command(cmd, timeout=None):
try:
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ stderr=subprocess.PIPE, close_fds=True)
if timeout is not None:
timer = Timer(timeout, kill_proc, [proc, timeout_flag])
timer.setDaemon(True)
--
2.1.0