# HG changeset patch # User Franz Glasner # Date 1592167136 -7200 # Node ID 346c4a4ca40bee12ba6e34f9d1e7ed6472789e44 # Parent 2500587e4a5e7f37fed8a0d782d3cc92592d94f9 Fix possible deadlock in install. When using`stderr=subprocess.PIPE, stdout=subprocess.PIPE`, you can (will) deadlock if one pipe fills up (in this case, stdout) while the other is being written too. The subprocess documentation is littered with warnings about this but somehow this has survived here for nearly 10 years. :) commit e3bed6a7172a03c2f03bc1355634ad7e9994b260 diff -r 2500587e4a5e -r 346c4a4ca40b uwsginl/files/patch-uwsgiconfig.py --- a/uwsginl/files/patch-uwsgiconfig.py Sun Jun 14 22:23:07 2020 +0200 +++ b/uwsginl/files/patch-uwsgiconfig.py Sun Jun 14 22:38:56 2020 +0200 @@ -1,6 +1,22 @@ --- uwsgiconfig.py.orig 2019-02-09 14:48:07 UTC +++ uwsgiconfig.py -@@ -1457,7 +1457,8 @@ def build_plugin(path, uc, cflags, ldflags, libs, name +@@ -203,11 +203,12 @@ int main() + + def spcall3(cmd): + p = subprocess.Popen(cmd, shell=True, stdin=open('/dev/null'), stderr=subprocess.PIPE, stdout=subprocess.PIPE) ++ (out, err) = p.communicate() + +- if p.wait() == 0: ++ if p.returncode == 0: + if sys.version_info[0] > 2: +- return p.stderr.read().rstrip().decode() +- return p.stderr.read().rstrip() ++ return err.rstrip().decode() ++ return err.rstrip() + else: + return None + +@@ -1457,7 +1458,8 @@ def build_plugin(path, uc, cflags, ldflags, libs, name gcc_list.append(path + '/' + cfile) for bfile in up.get('BINARY_LIST', []): try: @@ -10,7 +26,7 @@ print(binary_link_cmd) if os.system(binary_link_cmd) != 0: raise Exception('unable to link binary file') -@@ -1550,6 +1551,17 @@ def build_plugin(path, uc, cflags, ldflags, libs, name +@@ -1550,6 +1552,17 @@ def build_plugin(path, uc, cflags, ldflags, libs, name print("build time: %d seconds" % (time.time() - plugin_started_at)) print("*** %s plugin built and available in %s ***" % (name, plugin_dest + '.so'))