summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-12 11:44:07 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-19 16:22:12 +0100
commit2add0d0cea70329f807b43765ea3da1b1600bc98 (patch)
tree2291188207eee5dbd24508d3a5764ba6d55d833e /bitbake
parentc15296aa63dd0212c13892c46aed5f461725fea7 (diff)
downloadpoky-2add0d0cea70329f807b43765ea3da1b1600bc98.tar.gz
bitbake: server/process: Fix a rare lockfile race
We're seeing rare occasional races on the autobuilder as if two server processes have the lockfile at the same time. We need to be extremely careful this does not happen. I think there is a potential race in this shutdown code since we delete the lockfile, then call unlockfile() which also tries to delete it. This means we may remove a lock file now held by another process if we're unlucky. Since unlockfile removes the lockfile when it can, just rely on that and remove any possible race window. An example cooker-deamonlog: --- Starting bitbake server pid 2266 at 2020-07-11 06:17:18.210777 --- Started bitbake server pid 2266 Entering server connection loop Accepting [<socket.socket fd=20, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, laddr=bitbake.sock>] ([]) Processing Client Connecting Client Running command ['setFeatures', [2]] Running command ['updateConfig', XXX] Running command ['getVariable', 'BBINCLUDELOGS'] Running command ['getVariable', 'BBINCLUDELOGS_LINES'] Running command ['getSetVariable', 'BB_CONSOLELOG'] Running command ['getSetVariable', 'BB_LOGCONFIG'] Running command ['getUIHandlerNum'] Running command ['setEventMask', XXXX] Running command ['getVariable', 'BB_DEFAULT_TASK'] Running command ['setConfig', 'cmd', 'build'] Running command ['getVariable', 'BBTARGETS'] Running command ['parseFiles'] --- Starting bitbake server pid 8252 at 2020-07-11 06:17:28.584514 --- Started bitbake server pid 8252 --- Starting bitbake server pid 13278 at 2020-07-11 06:17:31.330635 --- Started bitbake server pid 13278 Running command ['dataStoreConnectorCmd', 0, 'getVar', ('BBMULTICONFIG',), {}] Running command ['getRecipes', ''] Running command ['clientComplete'] Processing Client Disconnecting Client No timeout, exiting. Exiting where it looks like there are two server processes running which should not be. In that build there was a process left sitting in memory with its bitbake.sock file missing but holding the lock (not sure why it wouldn't timeout/exit). (Bitbake rev: de919782f488a83b80d7c40896bf5b2596f1f65f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit e1a7c1821483031b224a1570bfe834da755219cc) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/server/process.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 83385baf60..475931a728 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -243,7 +243,7 @@ class ProcessServer(multiprocessing.Process):
243 lock = bb.utils.lockfile(lockfile, shared=False, retry=False, block=True) 243 lock = bb.utils.lockfile(lockfile, shared=False, retry=False, block=True)
244 if lock: 244 if lock:
245 # We hold the lock so we can remove the file (hide stale pid data) 245 # We hold the lock so we can remove the file (hide stale pid data)
246 bb.utils.remove(lockfile) 246 # via unlockfile.
247 bb.utils.unlockfile(lock) 247 bb.utils.unlockfile(lock)
248 return 248 return
249 249