summaryrefslogtreecommitdiffstats
path: root/bitbake
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 20:54:25 +0100
commita1f4d97bf8322461baa04145d235c20344655600 (patch)
tree2403533ebd686f9e4d16e7bd41862574b4e1c19f /bitbake
parenta89560d336d62b2ab474565980bbf769e7a0bea3 (diff)
downloadpoky-a1f4d97bf8322461baa04145d235c20344655600.tar.gz
bitbake: 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. (Bitbake rev: 7752c2c00245e91aeb17e22de484535190b18e5d) 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 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-worker10
1 files changed, 9 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index 3ca8c1853b..b3877b15c0 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -16,6 +16,8 @@ import signal
16import pickle 16import pickle
17import traceback 17import traceback
18import queue 18import queue
19import shlex
20import subprocess
19from multiprocessing import Lock 21from multiprocessing import Lock
20from threading import Thread 22from threading import Thread
21 23
@@ -145,6 +147,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
145 # a fork() or exec*() activates PSEUDO... 147 # a fork() or exec*() activates PSEUDO...
146 148
147 envbackup = {} 149 envbackup = {}
150 fakeroot = False
148 fakeenv = {} 151 fakeenv = {}
149 umask = None 152 umask = None
150 153
@@ -164,6 +167,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
164 167
165 # We can't use the fakeroot environment in a dry run as it possibly hasn't been built 168 # We can't use the fakeroot environment in a dry run as it possibly hasn't been built
166 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not dry_run: 169 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not dry_run:
170 fakeroot = True
167 envvars = (workerdata["fakerootenv"][fn] or "").split() 171 envvars = (workerdata["fakerootenv"][fn] or "").split()
168 for key, value in (var.split('=') for var in envvars): 172 for key, value in (var.split('=') for var in envvars):
169 envbackup[key] = os.environ.get(key) 173 envbackup[key] = os.environ.get(key)
@@ -282,7 +286,11 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
282 try: 286 try:
283 if dry_run: 287 if dry_run:
284 return 0 288 return 0
285 return bb.build.exec_task(fn, taskname, the_data, cfg.profile) 289 ret = bb.build.exec_task(fn, taskname, the_data, cfg.profile)
290 if fakeroot:
291 fakerootcmd = shlex.split(the_data.getVar("FAKEROOTCMD"))
292 subprocess.run(fakerootcmd + ['-S'], check=True, stdout=subprocess.PIPE)
293 return ret
286 except: 294 except:
287 os._exit(1) 295 os._exit(1)
288 if not profiling: 296 if not profiling: