[oe-commits] [bitbake] 01/02: process: Reorder server command processing and handle EOFError

git at git.openembedded.org git at git.openembedded.org
Mon Jul 31 08:01:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 974281ed72d8366baa16ee85f7e93970689b5956
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Mon Jul 31 08:09:03 2017 +0100

    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.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/server/process.py | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index e4b9d96..aefabbe 100644
--- a/lib/bb/server/process.py
+++ b/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")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list