[bitbake-devel] [PATCH 09/13] bitbake: event: do not abort on UI handlers error

Richard Purdie richard.purdie at linuxfoundation.org
Mon Sep 9 16:49:46 UTC 2013


On Mon, 2013-09-09 at 17:41 +0100, Alex DAMIAN wrote:
> From: Alexandru DAMIAN <alexandru.damian at intel.com>
> 
> Ignore runtime errors if UI handlers do something
> funny, as exiting while the loop is running.

This does look rather strange to me. How can a handler exit within the
loop? The handler is either another process or something we're using an
xmlrpc call too. Fine, the other end can disappear but our local end
(and entry in _ui_handlers) should exist until we remove it ourselves?

Only the server itself can do the removal and the server is single
threaded?

Cheers,

Richard




> This allows the builder to continue even if something
> happens to the UI handlers, useful for remote bitbake
> server.
> 
> Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
> ---
>  bitbake/lib/bb/event.py | 32 ++++++++++++++++++--------------
>  1 file changed, 18 insertions(+), 14 deletions(-)
> 
> diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
> index 67cfcea..1258471 100644
> --- a/bitbake/lib/bb/event.py
> +++ b/bitbake/lib/bb/event.py
> @@ -133,20 +133,24 @@ def fire_ui_handlers(event, d):
>          return
>  
>      errors = []
> -    for h in _ui_handlers:
> -        #print "Sending event %s" % event
> -        try:
> -             if not _ui_logfilters[h].filter(event):
> -                 continue
> -             # We use pickle here since it better handles object instances
> -             # which xmlrpc's marshaller does not. Events *must* be serializable
> -             # by pickle.
> -             if hasattr(_ui_handlers[h].event, "sendpickle"):
> -                _ui_handlers[h].event.sendpickle((pickle.dumps(event)))
> -             else:
> -                _ui_handlers[h].event.send(event)
> -        except:
> -            errors.append(h)
> +    try:
> +        for h in _ui_handlers:
> +            #print "Sending event %s" % event
> +            try:
> +                if not _ui_logfilters[h].filter(event):
> +                    continue
> +                # We use pickle here since it better handles object instances
> +                # which xmlrpc's marshaller does not. Events *must* be serializable
> +                # by pickle.
> +                if hasattr(_ui_handlers[h].event, "sendpickle"):
> +                    _ui_handlers[h].event.sendpickle((pickle.dumps(event)))
> +                else:
> +                    _ui_handlers[h].event.send(event)
> +            except:
> +                errors.append(h)
> +    except RuntimeError:     # may happen that the ui handler simple disappears :D
> +        errors.append(h)
> +
>      for h in errors:
>          del _ui_handlers[h]
>  





More information about the bitbake-devel mailing list