summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-26 18:27:28 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-30 13:05:03 +0100
commit849e26181d41f2c36898c5d81092c22f8adc1581 (patch)
tree2ffd23232e32035d024342c56a79a84de06ece32 /bitbake
parentaf5c7cf95f0adde15a8785ac7956841d7ac1ebce (diff)
downloadpoky-849e26181d41f2c36898c5d81092c22f8adc1581.tar.gz
bitbake: cooker: Improve exception handling in parsing process
If an exception occurs in the parsing process, ensure the cleanup is called via all codepaths using a try/finally. (Bitbake rev: e1ba2a69f1fc02f01a851bce20b1badf0b991f03) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index fb71a968f2..2264b18c54 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -2041,32 +2041,32 @@ class Parser(multiprocessing.Process):
2041 self.init() 2041 self.init()
2042 2042
2043 pending = [] 2043 pending = []
2044 while True: 2044 try:
2045 try: 2045 while True:
2046 self.quit.get_nowait()
2047 except queue.Empty:
2048 pass
2049 else:
2050 self.results.close()
2051 self.results.join_thread()
2052 break
2053
2054 if pending:
2055 result = pending.pop()
2056 else:
2057 try: 2046 try:
2058 job = self.jobs.pop() 2047 self.quit.get_nowait()
2059 except IndexError: 2048 except queue.Empty:
2060 self.results.close() 2049 pass
2061 self.results.join_thread() 2050 else:
2062 break 2051 break
2063 result = self.parse(*job) 2052
2064 # Clear the siggen cache after parsing to control memory usage, its huge 2053 if pending:
2065 bb.parse.siggen.postparsing_clean_cache() 2054 result = pending.pop()
2066 try: 2055 else:
2067 self.results.put(result, timeout=0.25) 2056 try:
2068 except queue.Full: 2057 job = self.jobs.pop()
2069 pending.append(result) 2058 except IndexError:
2059 break
2060 result = self.parse(*job)
2061 # Clear the siggen cache after parsing to control memory usage, its huge
2062 bb.parse.siggen.postparsing_clean_cache()
2063 try:
2064 self.results.put(result, timeout=0.25)
2065 except queue.Full:
2066 pending.append(result)
2067 finally:
2068 self.results.close()
2069 self.results.join_thread()
2070 2070
2071 def parse(self, mc, cache, filename, appends): 2071 def parse(self, mc, cache, filename, appends):
2072 try: 2072 try: