bitbake-worker: Try and avoid potential short write events issues
PATCH 1/1 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 <[email protected]>
--- bin/bitbake-worker | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
bin/bitbake-worker +6 -2
@@ -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)
Signature · 1 line
2.27.0