diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-07-14 09:48:19 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-16 15:09:26 +0100 |
commit | 5261c5b5bde25a5e4b2e9268ee401071a187468b (patch) | |
tree | 65ed20a3e9d6616ed9f91228bdcb437a5f179384 /bitbake/lib | |
parent | 723411dd92931de01d4e3b08a79638097bc2214f (diff) | |
download | poky-5261c5b5bde25a5e4b2e9268ee401071a187468b.tar.gz |
bitbake: lib/bb/process: check output of select() before reading extrafiles
We're calling select() to find the fds that have data available, so we
really ought to check the return to see if the extra file is in there
before trying to read from it. This is part of the fix for the
performance regression that this code introduced (5-10 minutes extra in
a reasonable size OE build); the rest is down to an issue in the way
that pseudo currently handles FIFOs and will need to be addressed there,
see: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7993
Solution suggested by Richard Purdie <richard.purdie@linuxfoundation.org>
(Bitbake rev: 3e2db8d7eaa0f14813213d1c95d3ee9efd97dc9d)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/process.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/bitbake/lib/bb/process.py b/bitbake/lib/bb/process.py index d95a03d176..7c797852ed 100644 --- a/bitbake/lib/bb/process.py +++ b/bitbake/lib/bb/process.py | |||
@@ -83,15 +83,16 @@ def _logged_communicate(pipe, log, input, extrafiles): | |||
83 | bb.utils.nonblockingfd(fobj.fileno()) | 83 | bb.utils.nonblockingfd(fobj.fileno()) |
84 | rin.append(fobj) | 84 | rin.append(fobj) |
85 | 85 | ||
86 | def readextras(): | 86 | def readextras(selected): |
87 | for fobj, func in extrafiles: | 87 | for fobj, func in extrafiles: |
88 | try: | 88 | if fobj in selected: |
89 | data = fobj.read() | 89 | try: |
90 | except IOError as err: | 90 | data = fobj.read() |
91 | if err.errno == errno.EAGAIN or err.errno == errno.EWOULDBLOCK: | 91 | except IOError as err: |
92 | data = None | 92 | if err.errno == errno.EAGAIN or err.errno == errno.EWOULDBLOCK: |
93 | if data is not None: | 93 | data = None |
94 | func(data) | 94 | if data is not None: |
95 | func(data) | ||
95 | 96 | ||
96 | try: | 97 | try: |
97 | while pipe.poll() is None: | 98 | while pipe.poll() is None: |
@@ -114,12 +115,12 @@ def _logged_communicate(pipe, log, input, extrafiles): | |||
114 | errdata.append(data) | 115 | errdata.append(data) |
115 | log.write(data) | 116 | log.write(data) |
116 | 117 | ||
117 | readextras() | 118 | readextras(r) |
118 | 119 | ||
119 | finally: | 120 | finally: |
120 | log.flush() | 121 | log.flush() |
121 | 122 | ||
122 | readextras() | 123 | readextras([fobj for fobj, _ in extrafiles]) |
123 | 124 | ||
124 | if pipe.stdout is not None: | 125 | if pipe.stdout is not None: |
125 | pipe.stdout.close() | 126 | pipe.stdout.close() |