diff options
Diffstat (limited to 'yocto-poky/bitbake/lib/bb/ui/uievent.py')
-rw-r--r-- | yocto-poky/bitbake/lib/bb/ui/uievent.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/yocto-poky/bitbake/lib/bb/ui/uievent.py b/yocto-poky/bitbake/lib/bb/ui/uievent.py index 7fc50c759..df093c53c 100644 --- a/yocto-poky/bitbake/lib/bb/ui/uievent.py +++ b/yocto-poky/bitbake/lib/bb/ui/uievent.py @@ -24,7 +24,7 @@ server and queue them for the UI to process. This process must be used to avoid client/server deadlocks. """ -import socket, threading, pickle +import socket, threading, pickle, collections from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler class BBUIEventQueue: @@ -44,27 +44,32 @@ class BBUIEventQueue: server.register_function( self.send_event, "event.sendpickle" ) server.socket.settimeout(1) - self.EventHandler = None - count_tries = 0 + self.EventHandle = None # the event handler registration may fail here due to cooker being in invalid state # this is a transient situation, and we should retry a couple of times before # giving up - while self.EventHandler == None and count_tries < 5: - self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port) + for count_tries in range(5): + ret = self.BBServer.registerEventHandler(self.host, self.port) - if (self.EventHandle != None): + if isinstance(ret, collections.Iterable): + self.EventHandle, error = ret + else: + self.EventHandle = ret + error = "" + + if self.EventHandle != None: break - bb.warn("Could not register UI event handler %s:%d, retry" % (self.host, self.port)) - count_tries += 1 + errmsg = "Could not register UI event handler. Error: %s, host %s, "\ + "port %d" % (error, self.host, self.port) + bb.warn("%s, retry" % errmsg) + import time time.sleep(1) - - - if self.EventHandle == None: - raise Exception("Could not register UI event handler") + else: + raise Exception(errmsg) self.server = server @@ -105,6 +110,7 @@ class BBUIEventQueue: def startCallbackHandler(self): self.server.timeout = 1 + bb.utils.set_process_name("UIEventQueue") while not self.server.quit: try: self.server.handle_request() |