diff options
| -rwxr-xr-x | bitbake/lib/bb/main.py | 13 | ||||
| -rw-r--r-- | bitbake/lib/bb/server/process.py | 8 |
2 files changed, 14 insertions, 7 deletions
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py index 0418d52b84..07972f69e5 100755 --- a/bitbake/lib/bb/main.py +++ b/bitbake/lib/bb/main.py | |||
| @@ -438,9 +438,10 @@ def setup_bitbake(configParams, configuration, extrafeatures=None): | |||
| 438 | return None, None | 438 | return None, None |
| 439 | # we start a server with a given configuration | 439 | # we start a server with a given configuration |
| 440 | logger.info("Starting bitbake server...") | 440 | logger.info("Starting bitbake server...") |
| 441 | server = bb.server.process.BitBakeServer(lock, sockname, configuration, featureset) | 441 | # Clear the event queue since we already displayed messages |
| 442 | # The server will handle any events already in the queue | ||
| 443 | bb.event.ui_queue = [] | 442 | bb.event.ui_queue = [] |
| 443 | server = bb.server.process.BitBakeServer(lock, sockname, configuration, featureset) | ||
| 444 | |||
| 444 | else: | 445 | else: |
| 445 | logger.info("Reconnecting to bitbake server...") | 446 | logger.info("Reconnecting to bitbake server...") |
| 446 | if not os.path.exists(sockname): | 447 | if not os.path.exists(sockname): |
| @@ -448,7 +449,13 @@ def setup_bitbake(configParams, configuration, extrafeatures=None): | |||
| 448 | time.sleep(5) | 449 | time.sleep(5) |
| 449 | raise bb.server.process.ProcessTimeout("Bitbake still shutting down as socket exists but no lock?") | 450 | raise bb.server.process.ProcessTimeout("Bitbake still shutting down as socket exists but no lock?") |
| 450 | if not configParams.server_only: | 451 | if not configParams.server_only: |
| 451 | server_connection = bb.server.process.connectProcessServer(sockname, featureset) | 452 | try: |
| 453 | server_connection = bb.server.process.connectProcessServer(sockname, featureset) | ||
| 454 | except EOFError: | ||
| 455 | # The server may have been shutting down but not closed the socket yet. If that happened, | ||
| 456 | # ignore it. | ||
| 457 | pass | ||
| 458 | |||
| 452 | if server_connection or configParams.server_only: | 459 | if server_connection or configParams.server_only: |
| 453 | break | 460 | break |
| 454 | except (Exception, bb.server.process.ProcessTimeout) as e: | 461 | except (Exception, bb.server.process.ProcessTimeout) as e: |
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): | |||
| 215 | ready = self.idle_commands(.1, fds) | 215 | ready = self.idle_commands(.1, fds) |
| 216 | 216 | ||
| 217 | print("Exiting") | 217 | print("Exiting") |
| 218 | # Remove the socket file so we don't get any more connections to avoid races | ||
| 219 | os.unlink(self.sockname) | ||
| 220 | self.sock.close() | ||
| 221 | |||
| 218 | try: | 222 | try: |
| 219 | self.cooker.shutdown(True) | 223 | self.cooker.shutdown(True) |
| 220 | except: | 224 | except: |
| @@ -222,10 +226,6 @@ class ProcessServer(multiprocessing.Process): | |||
| 222 | 226 | ||
| 223 | self.cooker.post_serve() | 227 | self.cooker.post_serve() |
| 224 | 228 | ||
| 225 | # Remove the socket file so we don't get any more connections to avoid races | ||
| 226 | os.unlink(self.sockname) | ||
| 227 | self.sock.close() | ||
| 228 | |||
| 229 | # Finally release the lockfile but warn about other processes holding it open | 229 | # Finally release the lockfile but warn about other processes holding it open |
| 230 | lock = self.bitbake_lock | 230 | lock = self.bitbake_lock |
| 231 | lockfile = lock.name | 231 | lockfile = lock.name |
