The Samba-Bugzilla – Attachment 13762 Details for
Bug 13127
Backport Popen deadlock selftest fixes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches for v4-{5,6,7}-test
tmp.diff.txt (text/plain), 4.16 KB, created by
Stefan Metzmacher
on 2017-11-09 08:37:53 UTC
(
hide
)
Description:
Patches for v4-{5,6,7}-test
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2017-11-09 08:37:53 UTC
Size:
4.16 KB
patch
obsolete
>From 6c09382c838239a6daf868e92f68a9d49a5067e6 Mon Sep 17 00:00:00 2001 >From: Gary Lockyer <gary@catalyst.net.nz> >Date: Wed, 16 Aug 2017 13:52:25 +1200 >Subject: [PATCH 1/2] blackbox tests: method to check specific exit codes > >Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> >Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Reviewed-by: Garming Sam <garming@catalyst.net.nz> >(cherry picked from commit 74ebcf6dfc84b6aab6838fa99e12808eb6b913d9) > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13127 >--- > python/samba/tests/__init__.py | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py >index 07c68c4..69c1a7f 100644 >--- a/python/samba/tests/__init__.py >+++ b/python/samba/tests/__init__.py >@@ -311,11 +311,20 @@ class BlackboxTestCase(TestCaseInTempDir): > return line > > def check_run(self, line): >+ self.check_exit_code(line, 0) >+ >+ def check_exit_code(self, line, expected): > line = self._make_cmdline(line) >- p = subprocess.Popen(line, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) >+ p = subprocess.Popen(line, >+ stdout=subprocess.PIPE, >+ stderr=subprocess.PIPE, >+ shell=True) > retcode = p.wait() >- if retcode: >- raise BlackboxProcessError(retcode, line, p.stdout.read(), p.stderr.read()) >+ if retcode != expected: >+ raise BlackboxProcessError(retcode, >+ line, >+ p.stdout.read(), >+ p.stderr.read()) > > def check_output(self, line): > line = self._make_cmdline(line) >-- >1.9.1 > > >From a7f4763e3ff2ecf36e6c489e0578d01b0b7d4f7b Mon Sep 17 00:00:00 2001 >From: Joe Guo <joeg@catalyst.net.nz> >Date: Fri, 15 Sep 2017 16:13:26 +1200 >Subject: [PATCH 2/2] python: use communicate to fix Popen deadlock > >`Popen.wait()` will deadlock when using stdout=PIPE and/or stderr=PIPE and the >child process generates large output to a pipe such that it blocks waiting for >the OS pipe buffer to accept more data. Use communicate() to avoid that. > >Signed-off-by: Joe Guo <joeg@catalyst.net.nz> >Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> > >Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> >Autobuild-Date(master): Thu Oct 19 09:27:16 CEST 2017 on sn-devel-144 > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13127 > >(cherry picked from commit 5dc773a5b00834c7a53130a73a48f49048bd55e8) >--- > python/samba/tests/__init__.py | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > >diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py >index 69c1a7f..0b0f567 100644 >--- a/python/samba/tests/__init__.py >+++ b/python/samba/tests/__init__.py >@@ -319,20 +319,22 @@ class BlackboxTestCase(TestCaseInTempDir): > stdout=subprocess.PIPE, > stderr=subprocess.PIPE, > shell=True) >- retcode = p.wait() >+ stdoutdata, stderrdata = p.communicate() >+ retcode = p.returncode > if retcode != expected: > raise BlackboxProcessError(retcode, > line, >- p.stdout.read(), >- p.stderr.read()) >+ stdoutdata, >+ stderrdata) > > def check_output(self, line): > line = self._make_cmdline(line) > p = subprocess.Popen(line, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, close_fds=True) >- retcode = p.wait() >+ stdoutdata, stderrdata = p.communicate() >+ retcode = p.returncode > if retcode: >- raise BlackboxProcessError(retcode, line, p.stdout.read(), p.stderr.read()) >- return p.stdout.read() >+ raise BlackboxProcessError(retcode, line, stdoutdata, stderrdata) >+ return stdoutdata > > > def connect_samdb(samdb_url, lp=None, session_info=None, credentials=None, >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
kseeger
:
review+
Actions:
View
Attachments on
bug 13127
: 13762