summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-31 08:09:03 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-31 15:13:53 +0100
commit129a52725f2de7f5599d89e301ffef8a1d4e27ab (patch)
treede17d2ea7a3e5c6f975dd646194c4d17b0b57373 /bitbake/lib/bb/server
parent780e9fb87796bff5445179412f69e80b9438f323 (diff)
downloadopenembedded-core-contrib-129a52725f2de7f5599d89e301ffef8a1d4e27ab.tar.gz
bitbake: process: Reorder server command processing and handle EOFError
If the connection control socket and the command channel close together, we can race and hit EOFError exceptions before we close the channel. Reorder the code to handle this in the correct order and ignore the EOFError exceptions as they mean the client is disconnecting and shouldn't terminate the server. (Bitbake rev: 974281ed72d8366baa16ee85f7e93970689b5956) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server')
-rw-r--r--bitbake/lib/bb/server/process.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index e4b9d96234..aefabbed01 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -133,19 +133,6 @@ class ProcessServer(multiprocessing.Process):
if self.xmlrpc:
fds.append(self.xmlrpc)
while not self.quit:
- if self.command_channel in ready:
- command = self.command_channel.get()
- if command[0] == "terminateServer":
- self.quit = True
- continue
- try:
- print("Running command %s" % command)
- self.command_channel_reply.send(self.cooker.command.runCommand(command))
- except Exception as e:
- logger.exception('Exception in server main event loop running command %s (%s)' % (command, str(e)))
-
- if self.xmlrpc in ready:
- self.xmlrpc.handle_requests()
if self.sock in ready:
self.controllersock, address = self.sock.accept()
if self.haveui:
@@ -194,6 +181,24 @@ class ProcessServer(multiprocessing.Process):
print("Server timeout, exiting.")
self.quit = True
+ if self.command_channel in ready:
+ try:
+ command = self.command_channel.get()
+ except EOFError:
+ # Client connection shutting down
+ continue
+ if command[0] == "terminateServer":
+ self.quit = True
+ continue
+ try:
+ print("Running command %s" % command)
+ self.command_channel_reply.send(self.cooker.command.runCommand(command))
+ except Exception as e:
+ logger.exception('Exception in server main event loop running command %s (%s)' % (command, str(e)))
+
+ if self.xmlrpc in ready:
+ self.xmlrpc.handle_requests()
+
ready = self.idle_commands(.1, fds)
print("Exiting")