diff options
-rwxr-xr-x | bitbake/bin/bitbake-worker | 14 | ||||
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker index a8a9660c5f..88217182fb 100755 --- a/bitbake/bin/bitbake-worker +++ b/bitbake/bin/bitbake-worker | |||
@@ -21,9 +21,14 @@ import traceback | |||
21 | import queue | 21 | import queue |
22 | import shlex | 22 | import shlex |
23 | import subprocess | 23 | import subprocess |
24 | import fcntl | ||
24 | from multiprocessing import Lock | 25 | from multiprocessing import Lock |
25 | from threading import Thread | 26 | from threading import Thread |
26 | 27 | ||
28 | # Remove when we have a minimum of python 3.10 | ||
29 | if not hasattr(fcntl, 'F_SETPIPE_SZ'): | ||
30 | fcntl.F_SETPIPE_SZ = 1031 | ||
31 | |||
27 | bb.utils.check_system_locale() | 32 | bb.utils.check_system_locale() |
28 | 33 | ||
29 | # Users shouldn't be running this code directly | 34 | # Users shouldn't be running this code directly |
@@ -44,7 +49,6 @@ if sys.argv[1].startswith("decafbadbad"): | |||
44 | # updates to log files for use with tail | 49 | # updates to log files for use with tail |
45 | try: | 50 | try: |
46 | if sys.stdout.name == '<stdout>': | 51 | if sys.stdout.name == '<stdout>': |
47 | import fcntl | ||
48 | fl = fcntl.fcntl(sys.stdout.fileno(), fcntl.F_GETFL) | 52 | fl = fcntl.fcntl(sys.stdout.fileno(), fcntl.F_GETFL) |
49 | fl |= os.O_SYNC | 53 | fl |= os.O_SYNC |
50 | fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, fl) | 54 | fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, fl) |
@@ -56,6 +60,12 @@ logger = logging.getLogger("BitBake") | |||
56 | 60 | ||
57 | worker_pipe = sys.stdout.fileno() | 61 | worker_pipe = sys.stdout.fileno() |
58 | bb.utils.nonblockingfd(worker_pipe) | 62 | bb.utils.nonblockingfd(worker_pipe) |
63 | # Try to make the pipe buffers larger as it is much more efficient. If we can't | ||
64 | # e.g. out of buffer space (/proc/sys/fs/pipe-user-pages-soft) then just pass over. | ||
65 | try: | ||
66 | fcntl.fcntl(worker_pipe, fcntl.F_SETPIPE_SZ, 512 * 1024) | ||
67 | except: | ||
68 | pass | ||
59 | # Need to guard against multiprocessing being used in child processes | 69 | # Need to guard against multiprocessing being used in child processes |
60 | # and multiple processes trying to write to the parent at the same time | 70 | # and multiple processes trying to write to the parent at the same time |
61 | worker_pipe_lock = None | 71 | worker_pipe_lock = None |
@@ -357,7 +367,7 @@ class runQueueWorkerPipe(): | |||
357 | def read(self): | 367 | def read(self): |
358 | start = len(self.queue) | 368 | start = len(self.queue) |
359 | try: | 369 | try: |
360 | self.queue.extend(self.input.read(102400) or b"") | 370 | self.queue.extend(self.input.read(512*1024) or b"") |
361 | except (OSError, IOError) as e: | 371 | except (OSError, IOError) as e: |
362 | if e.errno != errno.EAGAIN: | 372 | if e.errno != errno.EAGAIN: |
363 | raise | 373 | raise |
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 1b5b58f352..61608ac603 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -3318,7 +3318,7 @@ class runQueuePipe(): | |||
3318 | 3318 | ||
3319 | start = len(self.queue) | 3319 | start = len(self.queue) |
3320 | try: | 3320 | try: |
3321 | self.queue.extend(self.input.read(102400) or b"") | 3321 | self.queue.extend(self.input.read(512 * 1024) or b"") |
3322 | except (OSError, IOError) as e: | 3322 | except (OSError, IOError) as e: |
3323 | if e.errno != errno.EAGAIN: | 3323 | if e.errno != errno.EAGAIN: |
3324 | raise | 3324 | raise |