diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-06-03 16:26:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-06-06 10:32:54 +0100 |
commit | 506b5bd729920d7bab694f28d674888d1b7398db (patch) | |
tree | fce3dcbfdb65a681f41605079f21bb4b1268daef /bitbake/lib | |
parent | e89db137f008d7ead4e8ba81e704388eae69d7e4 (diff) | |
download | poky-506b5bd729920d7bab694f28d674888d1b7398db.tar.gz |
bitbake: uievent: retry on handler registration failure
The registration of a remote UI event handler may fail
if the server cooker is currently in some certain states.
This may happen, for example, when a remote UI is started
very fast after the bitbake server is started, and the
server hadn't time to finish initial configuration parsing.
Rather than fail outright, we have the remote UI event retry
registration for five time at one-second intervals,
in the hope it will succeed.
(Bitbake rev: c3d520c92ae4ae80d31926a416456df510654b6a)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/ui/uievent.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index eb760c00c3..c6b100c840 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py | |||
@@ -44,10 +44,26 @@ class BBUIEventQueue: | |||
44 | server.register_function( self.send_event, "event.sendpickle" ) | 44 | server.register_function( self.send_event, "event.sendpickle" ) |
45 | server.socket.settimeout(1) | 45 | server.socket.settimeout(1) |
46 | 46 | ||
47 | self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port) | 47 | self.EventHandler = None |
48 | count_tries = 0 | ||
48 | 49 | ||
49 | if (self.EventHandle == None): | 50 | # the event handler registration may fail here due to cooker being in invalid state |
50 | bb.warn("Could not register UI event handler %s:%d" % (self.host, self.port)) | 51 | # this is a transient situation, and we should retry a couple of times before |
52 | # giving up | ||
53 | |||
54 | while self.EventHandler == None and count_tries < 5: | ||
55 | self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port) | ||
56 | |||
57 | if (self.EventHandle != None): | ||
58 | break | ||
59 | |||
60 | bb.warn("Could not register UI event handler %s:%d, retry" % (self.host, self.port)) | ||
61 | count_tries += 1 | ||
62 | import time | ||
63 | time.sleep(1) | ||
64 | |||
65 | |||
66 | if self.EventHandle == None: | ||
51 | raise Exception("Could not register UI event handler") | 67 | raise Exception("Could not register UI event handler") |
52 | 68 | ||
53 | self.server = server | 69 | self.server = server |