From 2b453483d4610945c6156cc7f472ffae803cb28a Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 23 Aug 2017 15:46:00 +0100 Subject: bitbake: process: Clean up connection retry logic Its possible for a connection to connect to the server as its shutting down but before its removed the socket file. This patch: a) Removes the socket file earlier to avoid connections. b) Handles EOFError in initial connections gracefully. These occur if the socket is closed during the server shutdown. c) Ensure duplicate events aren't shown on the console. This makes debugging these issues very very confusing. With these changes the backtrace that was concerning users is hidden and the server works as expected with a reconnect when it catches it in a bad state. (Bitbake rev: f45196cf84669723382730944dddc7eaf50826f2) Signed-off-by: Richard Purdie --- bitbake/lib/bb/server/process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/bb/server') diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 3ab793c778..fad8aac4da 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py @@ -215,6 +215,10 @@ class ProcessServer(multiprocessing.Process): ready = self.idle_commands(.1, fds) print("Exiting") + # Remove the socket file so we don't get any more connections to avoid races + os.unlink(self.sockname) + self.sock.close() + try: self.cooker.shutdown(True) except: @@ -222,10 +226,6 @@ class ProcessServer(multiprocessing.Process): self.cooker.post_serve() - # Remove the socket file so we don't get any more connections to avoid races - os.unlink(self.sockname) - self.sock.close() - # Finally release the lockfile but warn about other processes holding it open lock = self.bitbake_lock lockfile = lock.name -- cgit v1.2.3-54-g00ecf