From d5b0a9a302ac0eafa4f797ac15ea77db87e82b3c Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 24 Dec 2018 16:32:18 +0000 Subject: process: Handle EWOULDBLOCK in socket connect Now that we set a timeout for the socket, it can return EWOULDBLOCK if a signal or other event happens to wake up even if we don't timeout. If this happens, retry the connection, else we simply see it quickly loop through the retries and abort the connection in a very short interval. Signed-off-by: Richard Purdie --- lib/bb/server/process.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index f1fbe3313..1e4b51e35 100644 --- a/lib/bb/server/process.py +++ b/lib/bb/server/process.py @@ -479,7 +479,14 @@ def connectProcessServer(sockname, featureset): try: try: os.chdir(os.path.dirname(sockname)) - sock.connect(os.path.basename(sockname)) + finished = False + while not finished: + try: + sock.connect(os.path.basename(sockname)) + finished = True + except IOError as e: + if e.errno == errno.EWOULDBLOCK: + pass finally: os.chdir(cwd) -- cgit 1.2.3-korg