summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-25 09:39:16 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-26 13:37:34 (GMT)
commiteab1c2087fd37af7b64c25545a7f39ccd2e607de (patch)
tree12c708ee19f59a1a0b5b9ad2e7d6d9fdb1e89f23
parent2692037fec997ead90a50c99c6dda8912fb28a59 (diff)
downloadpoky-eab1c2087fd37af7b64c25545a7f39ccd2e607de.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: a07a971b40acd3eee12e203d2cfa3e49f56109f6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 6ead2da..115bc1d 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -17,6 +17,8 @@ import signal
17import pickle 17import pickle
18import traceback 18import traceback
19import queue 19import queue
20import shlex
21import subprocess
20from multiprocessing import Lock 22from multiprocessing import Lock
21from threading import Thread 23from threading import Thread
22 24
@@ -146,6 +148,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
146 # a fork() or exec*() activates PSEUDO... 148 # a fork() or exec*() activates PSEUDO...
147 149
148 envbackup = {} 150 envbackup = {}
151 fakeroot = False
149 fakeenv = {} 152 fakeenv = {}
150 umask = None 153 umask = None
151 154
@@ -165,6 +168,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
165 168
166 # We can't use the fakeroot environment in a dry run as it possibly hasn't been built 169 # We can't use the fakeroot environment in a dry run as it possibly hasn't been built
167 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not dry_run: 170 if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not dry_run:
171 fakeroot = True
168 envvars = (workerdata["fakerootenv"][fn] or "").split() 172 envvars = (workerdata["fakerootenv"][fn] or "").split()
169 for key, value in (var.split('=') for var in envvars): 173 for key, value in (var.split('=') for var in envvars):
170 envbackup[key] = os.environ.get(key) 174 envbackup[key] = os.environ.get(key)
@@ -283,7 +287,11 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
283 try: 287 try:
284 if dry_run: 288 if dry_run:
285 return 0 289 return 0
286 return bb.build.exec_task(fn, taskname, the_data, cfg.profile) 290 ret = bb.build.exec_task(fn, taskname, the_data, cfg.profile)
291 if fakeroot:
292 fakerootcmd = shlex.split(the_data.getVar("FAKEROOTCMD"))
293 subprocess.run(fakerootcmd + ['-S'], check=True, stdout=subprocess.PIPE)
294 return ret
287 except: 295 except:
288 os._exit(1) 296 os._exit(1)
289 if not profiling: 297 if not profiling: