diff mbox series

process: Ensure writes to connect pipes are flushed

Message ID 20240330162148.1101054-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series process: Ensure writes to connect pipes are flushed | expand

Commit Message

Richard Purdie March 30, 2024, 4:21 p.m. UTC
In looking into a bitbake 'hang' on the autobuilders, it looked
very much like the server had finished a computation and was looping
at idle but the UI didn't see it. Adding in some os.fsync() calls should
help avoid this potential problem (but may cause other timeout/IO load
issues unfortunately).

The exception handling is needed since some writes cause the pipe to
close immediately so the flush would error.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/server/process.py | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 76b189291d..d0825582b5 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -867,6 +867,10 @@  class ConnectionWriter(object):
         gc.disable()
         with bb.utils.lock_timeout(self.wlock):
             self.writer.send_bytes(obj)
+            try:
+                os.fsync(self.fileno())
+            except OSError:
+                pass
         gc.enable()
 
     def send(self, obj):