diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-25 10:39:16 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-26 14:37:34 +0100 |
commit | eab1c2087fd37af7b64c25545a7f39ccd2e607de (patch) | |
tree | 12c708ee19f59a1a0b5b9ad2e7d6d9fdb1e89f23 /bitbake/bin/bitbake-worker | |
parent | 2692037fec997ead90a50c99c6dda8912fb28a59 (diff) | |
download | poky-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>
Diffstat (limited to 'bitbake/bin/bitbake-worker')
-rwxr-xr-x | bitbake/bin/bitbake-worker | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker index 6ead2da6d1..115bc1d091 100755 --- a/bitbake/bin/bitbake-worker +++ b/bitbake/bin/bitbake-worker | |||
@@ -17,6 +17,8 @@ import signal | |||
17 | import pickle | 17 | import pickle |
18 | import traceback | 18 | import traceback |
19 | import queue | 19 | import queue |
20 | import shlex | ||
21 | import subprocess | ||
20 | from multiprocessing import Lock | 22 | from multiprocessing import Lock |
21 | from threading import Thread | 23 | from 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: |