diff mbox series

cooker: Ignore KeyErrors duing shutdown

Message ID 20250801143948.932436-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series cooker: Ignore KeyErrors duing shutdown | expand

Commit Message

Richard Purdie Aug. 1, 2025, 2:39 p.m. UTC
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

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/cooker.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Peter Kjellerstedt Aug. 4, 2025, 12:10 p.m. UTC | #1
Two typos below.

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

duing -> during

> 
> 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
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/cooker.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
> index 2eb64ef2372..9f88ae7a7d5 100644
> --- a/lib/bb/cooker.py
> +++ b/lib/bb/cooker.py
> @@ -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

> +                    # reset. Ignore key errors for that reason, we don't care.
> +                    pass
> 
>          def sync_caches():
>              for c in self.bb_caches.values():

//Peter
diff mbox series

Patch

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 2eb64ef2372..9f88ae7a7d5 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -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():