bitbake: main/server: Add lockfile debugging upon server retry

We keep seeing server issues where the lockfile is present but we can't
connect to it. Reuse the lockfile debugging code from the server to
dump better information to the console from the client side when we
run into this issue. Whilst not pretty, this might give us a chance
of being able to debug the problems further.

(Bitbake rev: 22685460b5ecb1aeb4ff3436088ecdacb43044d7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2022-12-08 17:29:49 +00:00
parent 8aa083f842
commit a9505a86fd
2 changed files with 37 additions and 25 deletions

View File

@@ -422,7 +422,7 @@ def setup_bitbake(configParams, extrafeatures=None):
retries = 8
while retries:
try:
topdir, lock = lockBitbake()
topdir, lock, lockfile = lockBitbake()
sockname = topdir + "/bitbake.sock"
if lock:
if configParams.status_only or configParams.kill_server:
@@ -439,12 +439,15 @@ def setup_bitbake(configParams, extrafeatures=None):
logger.info("Reconnecting to bitbake server...")
if not os.path.exists(sockname):
logger.info("Previous bitbake instance shutting down?, waiting to retry... (%s)" % timestamp())
procs = bb.server.process.get_lockfile_process_msg(lockfile)
if procs:
logger.info("Processes holding bitbake.lock:\n%s" % procs)
i = 0
lock = None
# Wait for 5s or until we can get the lock
while not lock and i < 50:
time.sleep(0.1)
_, lock = lockBitbake()
_, lock, _ = lockBitbake()
i += 1
if lock:
bb.utils.unlockfile(lock)
@@ -494,5 +497,5 @@ def lockBitbake():
bb.error("Unable to find conf/bblayers.conf or conf/bitbake.conf. BBPATH is unset and/or not in a build directory?")
raise BBMainFatal
lockfile = topdir + "/bitbake.lock"
return topdir, bb.utils.lockfile(lockfile, False, False)
return topdir, bb.utils.lockfile(lockfile, False, False), lockfile