[bitbake-devel] [PATCH 1/1] bitbake: runqueue: catch hashvalidate error in RunQueueExecuteScenequeue

Richard Purdie richard.purdie at linuxfoundation.org
Wed Aug 27 14:35:13 UTC 2014


On Wed, 2014-08-27 at 22:16 +0800, Hongxu Jia wrote:
> On 08/27/2014 10:05 PM, Richard Purdie wrote:
> > On Wed, 2014-08-27 at 21:57 +0800, Hongxu Jia wrote:
> >> We need to catch the failure of self.rq.hashvalidate which invoked
> >> in RunQueueExecuteScenequeue, and exit in a normal build.
> >>
> >> So we raise and except bb.BBHandledException for this specific error.
> >>
> >> Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
> >> ---
> >>   bitbake/lib/bb/runqueue.py | 16 +++++++++++++---
> >>   1 file changed, 13 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
> >> index e13dc57..59e4188 100644
> >> --- a/bitbake/lib/bb/runqueue.py
> >> +++ b/bitbake/lib/bb/runqueue.py
> >> @@ -1046,7 +1046,14 @@ class RunQueue:
> >>                   self.state = runQueueComplete
> >>               else:
> >>                   self.start_worker()
> >> -                self.rqexe = RunQueueExecuteScenequeue(self)
> >> +                try:
> >> +                    self.rqexe = RunQueueExecuteScenequeue(self)
> >> +                except bb.BBHandledException:
> >> +                    # While hashvalidate failed, we need exit the normal build.
> >> +                    self.state = runQueueComplete
> >> +                except:
> >> +                    logger.error("RunQueueExecuteScenequeue init failed")
> >> +                    raise
> > Do you still need to do this with the change below? runqueue didn't
> > complete, it failed so the state doesn't seem right...
> 
> I want to exit the build peacefully, without too much break messages
> if we don't assign the above complete status, we have messages like this:
> ...
> ERROR: Hash validation failed in RunQueueExecuteScenequeue
> ERROR: An uncaught exception occured in runqueue, please see the failure 
> below:
> ERROR: Running idle function
> Traceback (most recent call last):
>                   try:
>      >                retval = function(self, data, False)
>                       if retval is False:
>                   try:
>      >                retval = rq.execute_runqueue()
>                   except runqueue.TaskFailure as exc:
>    File "/home/jiahongxu/yocto/poky/bitbake/lib/bb/runqueue.py", line 
> 1103, in RunQueue.execute_runqueue():
>               try:
>      >            return self._execute_runqueue()
>               except bb.runqueue.TaskFailure:
>    File "/home/jiahongxu/yocto/poky/bitbake/lib/bb/runqueue.py", line 
> 1049, in RunQueue._execute_runqueue():
>                       self.start_worker()
>      >                self.rqexe = RunQueueExecuteScenequeue(self)
>                       '''
>    File "/home/jiahongxu/yocto/poky/bitbake/lib/bb/runqueue.py", line 
> 1838, in RunQueueExecuteScenequeue.__init__(rq=<bb.runqueue.RunQueue 
> instance at 0x7f509f4bd950>):
>                       logger.error("Hash validation failed in 
> RunQueueExecuteScenequeue %s" % str(e))
>      >                raise bb.BBHandledException()
> 
> BBHandledException
> ...
> 
> Do you have ang ideas about how to exit the build peacefully?

I think bitbake has some deeper issues here we should fix. Firstly, I
think execute_runqueue should really do something like:

        try:
            return self._execute_runqueue()
        except bb.runqueue.TaskFailure:
            raise
        except BaseException as e:
            if not isinstance(e, (SystemExit, BBHandledException)):
                logger.error("An uncaught exception occured in runqueue, please see the failure below:")
            try:
                self.teardown_workers()
            except:
                pass
            self.state = runQueueComplete
            raise

then in buildFileIdle and buildTargetsIdle we should change SystemExit to (SystemExit, BBHandledException) too.

Cheers,

Richard





More information about the bitbake-devel mailing list