diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-10 11:29:50 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-10 19:25:38 +0000 |
| commit | ec2ba25376916857ec4cb66a9081fba8b7099d07 (patch) | |
| tree | 0997d590a8436cd203d2ada4ca9d9743159b63de | |
| parent | 2c46245f449d2716566ef668da0bf48f2109643a (diff) | |
| download | poky-ec2ba25376916857ec4cb66a9081fba8b7099d07.tar.gz | |
bitbake: cooker: Handle parsing results queue race
The previous fix introduced a race where the queue might not be empty
but all the parser processes have exited. Handle this correctly to avoid
occasional errors.
(Bitbake rev: 8e7f2b6500e26610f52d128b48ca0a09bf6fb2cb)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index d0163e8983..b2d8bbdbac 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
| @@ -2218,24 +2218,28 @@ class CookerParser(object): | |||
| 2218 | yield not cached, mc, infos | 2218 | yield not cached, mc, infos |
| 2219 | 2219 | ||
| 2220 | def parse_generator(self): | 2220 | def parse_generator(self): |
| 2221 | while self.processes: | 2221 | empty = False |
| 2222 | while self.processes or not empty: | ||
| 2223 | for process in self.processes.copy(): | ||
| 2224 | if not process.is_alive(): | ||
| 2225 | process.join() | ||
| 2226 | self.processes.remove(process) | ||
| 2227 | |||
| 2222 | if self.parsed >= self.toparse: | 2228 | if self.parsed >= self.toparse: |
| 2223 | break | 2229 | break |
| 2224 | 2230 | ||
| 2225 | try: | 2231 | try: |
| 2226 | result = self.result_queue.get(timeout=0.25) | 2232 | result = self.result_queue.get(timeout=0.25) |
| 2227 | except queue.Empty: | 2233 | except queue.Empty: |
| 2234 | empty = True | ||
| 2228 | pass | 2235 | pass |
| 2229 | else: | 2236 | else: |
| 2237 | empty = False | ||
| 2230 | value = result[1] | 2238 | value = result[1] |
| 2231 | if isinstance(value, BaseException): | 2239 | if isinstance(value, BaseException): |
| 2232 | raise value | 2240 | raise value |
| 2233 | else: | 2241 | else: |
| 2234 | yield result | 2242 | yield result |
| 2235 | for process in self.processes.copy(): | ||
| 2236 | if not process.is_alive(): | ||
| 2237 | process.join() | ||
| 2238 | self.processes.remove(process) | ||
| 2239 | 2243 | ||
| 2240 | if not (self.parsed >= self.toparse): | 2244 | if not (self.parsed >= self.toparse): |
| 2241 | raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None) | 2245 | raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None) |
