diff options
author | Randy Witt <randy.e.witt@linux.intel.com> | 2015-08-26 00:15:15 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-26 08:23:41 +0100 |
commit | 2f5cbfee0ab1189fbb83f0e785d79c8d123fccc2 (patch) | |
tree | 956c2a07c3b72c1ed4dedddb2bd9c7e8599ec9ff /meta/lib/oeqa/utils | |
parent | f59c875fea839052b5bdd950cb74e0c60a0ba946 (diff) | |
download | openembedded-core-2f5cbfee0ab1189fbb83f0e785d79c8d123fccc2.tar.gz openembedded-core-2f5cbfee0ab1189fbb83f0e785d79c8d123fccc2.tar.bz2 openembedded-core-2f5cbfee0ab1189fbb83f0e785d79c8d123fccc2.zip |
qemurunner: In the logging thread retry on EAGAIN, EWOULDBLOCK
On a nonblocking socket an exception can be generated for the EAGAIN
and EWOULDBLOCK errnos. Since these aren't actually errors make sure to
retry rather than bailing out.
Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index d079072af8..6d36df6953 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py @@ -412,12 +412,33 @@ class LoggingThread(threading.Thread): # Actual data to be logged elif self.readsock.fileno() == event[0]: - data = self.readsock.recv(1024) - if not data: - raise Exception("No data on read ready socket") - + data = self.recv_loop() self.logfunc(data) + # Since the socket is non-blocking make sure to honor EAGAIN + # and EWOULDBLOCK + def recv_loop(self): + while True: + try: + data = self.readsock.recv(1024) + break + except socket.error as e: + if e.errno == errno.EAGAIN or e.errno == errno.EWOULDBLOCK: + continue + else: + raise + + if not data: + raise Exception("No data on read ready socket") + elif data == 0: + # This actually means an orderly shutdown + # happened. But for this code it counts as an + # error since the connection shouldn't go away + # until qemu exits. + raise Exception("Console connection closed unexpectedly") + + return data + def stringify_event(self, event): val = '' if select.POLLERR == event: |