Skip to contentSkip to conversation

process: Ensure we call select() to know which fds to read

PATCH New Richard Purdie 1 participant 1 message Aug 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 process: Ensure we call select() to know which fds to read

There is an interesting bug in the current code where a sync command is not seen until the current async command completes, by which time the UI may have shut down.

The reason is that if there are idle commands, we may not end up sleeping in the select call at all, partiularly under heavy load like parsing.

Fix this by calling select with a zero timeout so that we see active fds and know to read from them. This fixes various problems toaster was having with the recent server changes.

[YOCTO #11898]

---
 lib/bb/server/process.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/server/process.py +1 -1
index 2ebfdfc..3ab793c 100644
@@ -312,7 +312,7 @@ class ProcessServer(multiprocessing.Process):
                 # Ignore EINTR
                 return []
         else:
-            return []
+            return select.select(fds,[],[],0)[0]
 
 
 class ServerCommunicator():
Signature · 1 line
2.7.4