summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-06 15:59:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-06 23:45:36 +0000
commitbdfc5207a0fdbed889c4a5997306adab82b1c2d4 (patch)
tree814509d6cae5160fae9d9a5ad7dc2952d49a0114 /bitbake
parentafd24faa00fdf622235fc1125eddd1da8afb0323 (diff)
downloadpoky-bdfc5207a0fdbed889c4a5997306adab82b1c2d4.tar.gz
poky-bdfc5207a0fdbed889c4a5997306adab82b1c2d4.tar.bz2
poky-bdfc5207a0fdbed889c4a5997306adab82b1c2d4.zip
bitbake: bitbake: Always use separate process for PR Service
Using the threading module interacts badly with multiprocessing used elsewhere in bitbake under certain machine loads. This was leading to bitbake hanging on Ctrl+C when the PR Server was being used. This patch converts it to always use the daemonize code which then means the threading code isn't required. [YOCTO #3742] (Bitbake rev: 2d0bbd9398ab839bd2d1e29e50b25d52efb1ce2a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/server/process.py2
-rw-r--r--bitbake/lib/prserv/serv.py29
2 files changed, 8 insertions, 23 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 8ebf771878..5e2cade267 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -266,5 +266,5 @@ class BitBakeServer(object):
return self.connection
def launchUI(self, uifunc, *args):
- return bb.cooker.server_main(self.cooker, uifunc, *args)
+ return uifunc(*args)
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index d8bdf31ba9..719941b32e 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -97,16 +97,7 @@ class PRServer(SimpleXMLRPCServer):
return
def start(self):
- if self.daemon is True:
- logger.info("PRServer: try to start daemon...")
- self.daemonize()
- else:
- atexit.register(self.delpid)
- pid = str(os.getpid())
- pf = file(self.pidfile, 'w+')
- pf.write("%s\n" % pid)
- pf.close()
- self.work_forever()
+ self.daemonize()
def delpid(self):
os.remove(self.pidfile)
@@ -118,6 +109,7 @@ class PRServer(SimpleXMLRPCServer):
try:
pid = os.fork()
if pid > 0:
+ os.waitpid(pid, 0)
#parent return instead of exit to give control
return
except OSError as e:
@@ -131,7 +123,7 @@ class PRServer(SimpleXMLRPCServer):
try:
pid = os.fork()
if pid > 0: #parent
- sys.exit(0)
+ os._exit(0)
except OSError as e:
raise Exception("%s [%d]" % (e.strerror, e.errno))
@@ -155,7 +147,7 @@ class PRServer(SimpleXMLRPCServer):
pf.close()
self.work_forever()
- sys.exit(0)
+ os._exit(0)
class PRServSingleton():
def __init__(self, dbfile, logfile, interface):
@@ -164,21 +156,14 @@ class PRServSingleton():
self.interface = interface
self.host = None
self.port = None
- self.event = threading.Event()
- def _work(self):
- self.prserv = PRServer(self.dbfile, self.logfile, self.interface, False)
+ def start(self):
+ self.prserv = PRServer(self.dbfile, self.logfile, self.interface)
+ self.prserv.start()
self.host, self.port = self.prserv.getinfo()
- self.event.set()
- self.prserv.work_forever()
del self.prserv.db
- def start(self):
- self.working_thread = threading.Thread(target=self._work)
- self.working_thread.start()
-
def getinfo(self):
- self.event.wait()
return (self.host, self.port)
class PRServerConnection():