diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-05 17:55:33 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-06 09:12:00 +0000 |
commit | 2ffbb020fe1d9f332fdc58cd93d7a41885850771 (patch) | |
tree | c3522153ee595efa65ec7b8f37d59b9f65a28fa1 /bitbake/bin | |
parent | adcd9608a725d99e2e6ca74d4a31e6edb353af0c (diff) | |
download | poky-2ffbb020fe1d9f332fdc58cd93d7a41885850771.tar.gz |
bitbake: bitbake-worker: Try and avoid potential short write events issues
We're seeing occasional issues where builds fail as events were written from the
worker children in the form <event>partial data<event>full event</event>.
This causes failures as bitbake server can't parse that and exits. This could
be due to short writes to the worker event pipe which we weren't checking. Check
this and loop accordingly. Also add some asserts to detect other potential causes.
Thanks to Joshua Watt for help in spotting the issue.
[YOCTO #14181]
(Bitbake rev: a9451746a4bd7ccedf4c72cd03ad4ff0ab0143aa)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-x | bitbake/bin/bitbake-worker | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker index 9334f11fb8..40da7a0c2b 100755 --- a/bitbake/bin/bitbake-worker +++ b/bitbake/bin/bitbake-worker | |||
@@ -118,7 +118,9 @@ def worker_child_fire(event, d): | |||
118 | data = b"<event>" + pickle.dumps(event) + b"</event>" | 118 | data = b"<event>" + pickle.dumps(event) + b"</event>" |
119 | try: | 119 | try: |
120 | worker_pipe_lock.acquire() | 120 | worker_pipe_lock.acquire() |
121 | worker_pipe.write(data) | 121 | while(len(data)): |
122 | written = worker_pipe.write(data) | ||
123 | data = data[written:] | ||
122 | worker_pipe_lock.release() | 124 | worker_pipe_lock.release() |
123 | except IOError: | 125 | except IOError: |
124 | sigterm_handler(None, None) | 126 | sigterm_handler(None, None) |
@@ -321,7 +323,9 @@ class runQueueWorkerPipe(): | |||
321 | end = len(self.queue) | 323 | end = len(self.queue) |
322 | index = self.queue.find(b"</event>") | 324 | index = self.queue.find(b"</event>") |
323 | while index != -1: | 325 | while index != -1: |
324 | worker_fire_prepickled(self.queue[:index+8]) | 326 | msg = self.queue[:index+8] |
327 | assert msg.startswith(b"<event>") and msg.count(b"<event>") == 1 | ||
328 | worker_fire_prepickled(msg) | ||
325 | self.queue = self.queue[index+8:] | 329 | self.queue = self.queue[index+8:] |
326 | index = self.queue.find(b"</event>") | 330 | index = self.queue.find(b"</event>") |
327 | return (end > start) | 331 | return (end > start) |