Skip to contentSkip to conversation

bitbake-server: ensure server timeout is a float

PATCH New Ross Burton 1 participant 1 message Apr 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bitbake-server: ensure server timeout is a float

bitbake-server is spawned by process.py and passes the arguments it is given to ProcessServer. There's some type confusion here:

bitbake-server is called with a string representation of the timeout, which may be None. If the timeout is not set, pass 0 instead of None.

Inside bitbake-server a ProcessServer is created which expects the timeout to be a float not a string, so always float() the value.

[ YOCTO #14350 ]

---
 bitbake/bin/bitbake-server       | 2 +-
 bitbake/lib/bb/server/process.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
bitbake/bin/bitbake-server +1 -1
index ffbc7894ef7..65796be7473 100755
@@ -26,7 +26,7 @@ readypipeinfd = int(sys.argv[3])
 logfile = sys.argv[4]
 lockname = sys.argv[5]
 sockname = sys.argv[6]
-timeout = sys.argv[7]
+timeout = float(sys.argv[7])
 xmlrpcinterface = (sys.argv[8], int(sys.argv[9]))
 if xmlrpcinterface[0] == "None":
     xmlrpcinterface = (None, xmlrpcinterface[1])
bitbake/lib/bb/server/process.py +1 -1
index b27b4aefe0e..3e99bcef8f2 100644
@@ -509,7 +509,7 @@ class BitBakeServer(object):
         os.set_inheritable(self.bitbake_lock.fileno(), True)
         os.set_inheritable(self.readypipein, True)
         serverscript = os.path.realpath(os.path.dirname(__file__) + "/../../../bin/bitbake-server")
-        os.execl(sys.executable, "bitbake-server", serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname,  str(self.server_timeout), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1]))
+        os.execl(sys.executable, "bitbake-server", serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname,  str(self.server_timeout or 0), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1]))
 
 def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpcinterface):
 
Signature · 1 line
2.25.1