Patchwork [bitbake-devel,7/7] knotty.py: Handle rare interrupted select call

login
register
mail settings
Submitter Mark Hatle
Date May 29, 2013, 3:59 a.m.
Message ID <1369799955-1488-7-git-send-email-mark.hatle@windriver.com>
Download mbox | patch
Permalink /patch/50655/
State New
Headers show

Comments

Mark Hatle - May 29, 2013, 3:59 a.m.
From: Jason Wessel <jason.wessel@windriver.com>

Under a high load and while resizing the terminal window, I received the following traceback:

Traceback (most recent call last):
  File "/bitbake/bin//bitbake", line 263, in <module>
    ret = main()
  File "/bitbake/bin//bitbake", line 252, in main
    return server.launchUI(ui_main, server_connection.connection, server_connection.events)
  File "/bitbake/lib/bb/server/process.py", line 269, in launchUI
    return bb.cooker.server_main(self.cooker, uifunc, *args)
  File "/bitbake/lib/bb/cooker.py", line 1407, in server_main
    ret = func(*args)
  File "/bitbake/lib/bb/ui/knotty.py", line 385, in main
    if stdin_mgr.poll():
error: (4, 'Interrupted system call')

Interrupted system calls from a sigwinch are certainly possible and the
right thing to do is just restart the system call, or in this case,
punt and wait until the next poll cycle.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 lib/bb/ui/knotty.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch

diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index b2fb141..5cea884 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -262,7 +262,11 @@  class StdinMgr:
     def poll(self):
         if not self.stdinbackup:
             return False
-        return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], [])
+        try:
+            ret = select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], [])
+        except:
+            return False
+        return ret
 
     def restore(self):
         if self.stdinbackup: