summaryrefslogtreecommitdiff
path: root/src/saml2/sigver.py
diff options
context:
space:
mode:
authorJozef Knaperek <jknaperek@gmail.com>2016-02-26 17:38:07 +0100
committerJozef Knaperek <jknaperek@gmail.com>2016-02-26 17:38:07 +0100
commitdc996f87cfcb0209c7d98bc951569fb595cac2d3 (patch)
treec0586440e4920c3292e67f5f177a56d9916b10f6 /src/saml2/sigver.py
parent24f141c99fad620ae8f576d317e550d453a63d47 (diff)
downloadpysaml2-dc996f87cfcb0209c7d98bc951569fb595cac2d3.tar.gz
Wait until xmlsec program completes to avoid zombies
Popen was often used to execute the xmlsec program without calling wait() on the process file handler, which resulted in zombies being left for arbitrary time (depending on gc). Adding the wait() call as implemented by this fix should not cause any delays nor deadlocks since it is always run only after the program finishes - after stdout and stderr are read. It should thus not cause any regressions. For more info about Popen causing zombies, please see: http://stackoverflow.com/questions/2760652/how-to-kill-or-avoid-zombie-processes-with-subprocess-module https://lbolla.info/blog/2014/01/23/die-zombie-die
Diffstat (limited to 'src/saml2/sigver.py')
-rw-r--r--src/saml2/sigver.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/saml2/sigver.py b/src/saml2/sigver.py
index f67db591..04502797 100644
--- a/src/saml2/sigver.py
+++ b/src/saml2/sigver.py
@@ -797,6 +797,7 @@ class CryptoBackendXmlSec1(CryptoBackend):
com_list = [self.xmlsec, "--version"]
pof = Popen(com_list, stderr=PIPE, stdout=PIPE)
content = pof.stdout.read().decode('ascii')
+ pof.wait()
try:
return content.split(" ")[1]
except IndexError:
@@ -990,6 +991,7 @@ class CryptoBackendXmlSec1(CryptoBackend):
p_out = pof.stdout.read().decode('utf-8')
p_err = pof.stderr.read().decode('utf-8')
+ pof.wait()
if pof.returncode is not None and pof.returncode < 0:
logger.error(LOG_LINE, p_out, p_err)