aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-25 22:15:52 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-25 19:55:54 +0100
commit7752c2c00245e91aeb17e22de484535190b18e5d (patch)
treedd75a7cb2649bddcb3d1cc63b21b62f9a0c4e6d6 /bin
parent591a05d6126f29b501b9fa284c0618de8c903c69 (diff)
downloadbitbake-7752c2c00245e91aeb17e22de484535190b18e5d.tar.gz
bitbake-worker: Allow shutdown/database flush of pseudo server at task exit
We have a problem where pseudo server processes exist after bitbake exits and hold the pseudo database in memory. In a docker container, the processes will be killed as the container is destroyed with no warning and no opportunity to write the data to disk. This leads to permissions/inode corruptions and data loss. Send a shutdown message to pseudo which in new versions of pseudo will flush the database, thereby fixing some of the issues people using docker containers see. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit a07a971b40acd3eee12e203d2cfa3e49f56109f6) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bitbake-worker10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 3ca8c1853..b3877b15c 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -16,6 +16,8 @@ import signal
import pickle
import traceback
import queue
+import shlex
+import subprocess
from multiprocessing import Lock
from threading import Thread
@@ -145,6 +147,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
# a fork() or exec*() activates PSEUDO...
envbackup = {}
+ fakeroot = False
fakeenv = {}
umask = None
@@ -164,6 +167,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
# We can't use the fakeroot environment in a dry run as it possibly hasn't been built
if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not dry_run:
+ fakeroot = True
envvars = (workerdata["fakerootenv"][fn] or "").split()
for key, value in (var.split('=') for var in envvars):
envbackup[key] = os.environ.get(key)
@@ -282,7 +286,11 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
try:
if dry_run:
return 0
- return bb.build.exec_task(fn, taskname, the_data, cfg.profile)
+ ret = bb.build.exec_task(fn, taskname, the_data, cfg.profile)
+ if fakeroot:
+ fakerootcmd = shlex.split(the_data.getVar("FAKEROOTCMD"))
+ subprocess.run(fakerootcmd + ['-S'], check=True, stdout=subprocess.PIPE)
+ return ret
except:
os._exit(1)
if not profiling: