Skip to contentSkip to conversation

cooker: Ignore KeyErrors duing shutdown

PATCH In review Richard Purdie 2 participants 2 messages Aug 1, 2025 – Aug 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cooker: Ignore KeyErrors duing shutdown

When parsing failures occur, trap KeyError to avoid these kinds of tracebacks (from a parsing error in meta-ti).

bb.parse.ParseError: ParseError at /srv/pokybuild/yocto-worker/check-layer-nightly/build/meta-ti/meta-ti-bsp/recipes-kernel/linux/linux-ti-mainline_git.bb:6: Could not inherit file classes/${KERNEL_BASE_CLASS}.bbclass

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/command.py", line 123, in runAsyncCommand
self.cooker.updateCache()
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cooker.py", line 1639, in updateCache
if not self.parser.parse_next():
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cooker.py", line 2314, in parse_next
self.shutdown(clean=False, eventmsg=str(exc))
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cooker.py", line 2209, in shutdown
read_results()
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cooker.py", line 2195, in read_results

    self.result_queue.get(timeout=0.25)

File "/usr/lib/python3.10/multiprocessing/queues.py", line 122, in get
return _ForkingPickler.loads(res)
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cache.py", line 338, in __setstate__
setattr(self, key, self._restore(state[key], pid))
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cache.py", line 318, in _restore
ret[dep] = map[mapnum]
KeyError: 156

---
 lib/bb/cooker.py | 5 +++++
 1 file changed, 5 insertions(+)
lib/bb/cooker.py +5 -0
index 2eb64ef2372..9f88ae7a7d5 100644
@@ -2195,6 +2195,11 @@ class CookerParser(object):
                    self.result_queue.get(timeout=0.25)
                 except queue.Empty:
                     break
+                except KeyError:
+                    # The restore state from SiggenRecipeInfo in cache.py can
+                    # fail here if this is an unclean shutdown since the state may be been
+                    # reset. Ignore key errors for that reason, we don't care.
+                    pass
 
         def sync_caches():
             for c in self.bb_caches.values():
#1 lore raw

Two typos below.

Quoted 6 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Richard Purdie via lists.openembedded.org
Sent: den 1 augusti 2025 16:40
To: [email protected]
Subject: [bitbake-devel] [PATCH] cooker: Ignore KeyErrors duing shutdown

duing -> during

Quoted 37 lines

When parsing failures occur, trap KeyError to avoid these kinds of tracebacks (from a parsing error in meta-ti).

bb.parse.ParseError: ParseError at /srv/pokybuild/yocto-worker/check-layer-nightly/build/meta-ti/meta-ti-bsp/recipes-kernel/linux/linux-ti-mainline_git.bb:6: Could not inherit file classes/${KERNEL_BASE_CLASS}.bbclass

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/command.py", line 123, in runAsyncCommand
self.cooker.updateCache()
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cooker.py", line 1639, in updateCache
if not self.parser.parse_next():
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cooker.py", line 2314, in parse_next
self.shutdown(clean=False, eventmsg=str(exc))
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cooker.py", line 2209, in shutdown
read_results()
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cooker.py", line 2195, in read_results

    self.result_queue.get(timeout=0.25)

File "/usr/lib/python3.10/multiprocessing/queues.py", line 122, in get
return _ForkingPickler.loads(res)
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cache.py", line 338, in __setstate__
setattr(self, key, self._restore(state[key], pid))
File "/srv/pokybuild/yocto-worker/check-layer-nightly/build/lib/bb/cache.py", line 318, in _restore
ret[dep] = map[mapnum]
KeyError: 156

---
 lib/bb/cooker.py | 5 +++++
 1 file changed, 5 insertions(+)
lib/bb/cooker.py +0 -0
index 2eb64ef2372..9f88ae7a7d5 100644

lib/bb/cooker.py class CookerParser(object): · line 2200

Quoted 6 lines
lib/bb/cooker.py +3 -0
@@ -2195,6 +2195,11 @@ class CookerParser(object):
                    self.result_queue.get(timeout=0.25)
                 except queue.Empty:
                     break
+                except KeyError:
+                    # The restore state from SiggenRecipeInfo in cache.py can
+                    # fail here if this is an unclean shutdown since the state may be been

be been -> have been

lib/bb/cooker.py class CookerParser(object): · line 2205

Quoted 5 lines
lib/bb/cooker.py +2 -0
+                    # reset. Ignore key errors for that reason, we don't care.
+                    pass
 
         def sync_caches():
             for c in self.bb_caches.values():

//Peter