aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-05 17:55:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-06 09:11:37 +0000
commita9451746a4bd7ccedf4c72cd03ad4ff0ab0143aa (patch)
treec6ecbf807747d1c51beabef16716c8fc61acb18c /bin
parentbf75370bcd6d02ed08cd959eec6190196b792515 (diff)
downloadbitbake-a9451746a4bd7ccedf4c72cd03ad4ff0ab0143aa.tar.gz
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] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bitbake-worker8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 9334f11fb..40da7a0c2 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -118,7 +118,9 @@ def worker_child_fire(event, d):
data = b"<event>" + pickle.dumps(event) + b"</event>"
try:
worker_pipe_lock.acquire()
- worker_pipe.write(data)
+ while(len(data)):
+ written = worker_pipe.write(data)
+ data = data[written:]
worker_pipe_lock.release()
except IOError:
sigterm_handler(None, None)
@@ -321,7 +323,9 @@ class runQueueWorkerPipe():
end = len(self.queue)
index = self.queue.find(b"</event>")
while index != -1:
- worker_fire_prepickled(self.queue[:index+8])
+ msg = self.queue[:index+8]
+ assert msg.startswith(b"<event>") and msg.count(b"<event>") == 1
+ worker_fire_prepickled(msg)
self.queue = self.queue[index+8:]
index = self.queue.find(b"</event>")
return (end > start)