diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-07-31 10:49:39 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-08-06 11:21:32 +0100 |
commit | 43d37a6eaf2224c0dda1d1436a0afc2bd34fdddf (patch) | |
tree | 273e6a02584e2222a4f2b7249018dbd487e818e4 /bitbake/lib/bb | |
parent | d40d7e43856f176c45cf515644b5f211c708e237 (diff) | |
download | poky-43d37a6eaf2224c0dda1d1436a0afc2bd34fdddf.tar.gz |
bitbake: hashserv: Switch from threads to multiprocessing
There were hard to debug lockups when trying to use threading to start
hashserv as a thread. Switch to multiprocessing which doesn't show the
same locking problems.
(Bitbake rev: be23d887c8e244f1ef961298fbc9214d0fd0968a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 84f25ec94e..6e1d59bb3a 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -193,6 +193,8 @@ class BBCooker: | |||
193 | bb.parse.BBHandler.cached_statements = {} | 193 | bb.parse.BBHandler.cached_statements = {} |
194 | 194 | ||
195 | self.ui_cmdline = None | 195 | self.ui_cmdline = None |
196 | self.hashserv = None | ||
197 | self.hashservport = None | ||
196 | 198 | ||
197 | self.initConfigurationData() | 199 | self.initConfigurationData() |
198 | 200 | ||
@@ -231,8 +233,6 @@ class BBCooker: | |||
231 | self.state = state.initial | 233 | self.state = state.initial |
232 | 234 | ||
233 | self.parser = None | 235 | self.parser = None |
234 | self.hashserv = None | ||
235 | self.hashservport = None | ||
236 | 236 | ||
237 | signal.signal(signal.SIGTERM, self.sigterm_exception) | 237 | signal.signal(signal.SIGTERM, self.sigterm_exception) |
238 | # Let SIGHUP exit as SIGTERM | 238 | # Let SIGHUP exit as SIGTERM |
@@ -372,12 +372,13 @@ class BBCooker: | |||
372 | self.data.setVar('BB_CMDLINE', self.ui_cmdline) | 372 | self.data.setVar('BB_CMDLINE', self.ui_cmdline) |
373 | 373 | ||
374 | if self.data.getVar("BB_HASHSERVE") == "localhost:0": | 374 | if self.data.getVar("BB_HASHSERVE") == "localhost:0": |
375 | dbfile = (self.data.getVar("PERSISTENT_DIR") or self.data.getVar("CACHE")) + "/hashserv.db" | 375 | if not self.hashserv: |
376 | self.hashserv = hashserv.create_server(('localhost', 0), dbfile, '') | 376 | dbfile = (self.data.getVar("PERSISTENT_DIR") or self.data.getVar("CACHE")) + "/hashserv.db" |
377 | self.hashservport = "localhost:" + str(self.hashserv.server_port) | 377 | self.hashserv = hashserv.create_server(('localhost', 0), dbfile, '') |
378 | thread = threading.Thread(target=self.hashserv.serve_forever) | 378 | self.hashservport = "localhost:" + str(self.hashserv.server_port) |
379 | thread.daemon = True | 379 | self.hashserv.process = multiprocessing.Process(target=self.hashserv.serve_forever) |
380 | thread.start() | 380 | self.hashserv.process.daemon = True |
381 | self.hashserv.process.start() | ||
381 | self.data.setVar("BB_HASHSERVE", self.hashservport) | 382 | self.data.setVar("BB_HASHSERVE", self.hashservport) |
382 | 383 | ||
383 | # | 384 | # |
@@ -1658,7 +1659,8 @@ class BBCooker: | |||
1658 | def post_serve(self): | 1659 | def post_serve(self): |
1659 | prserv.serv.auto_shutdown() | 1660 | prserv.serv.auto_shutdown() |
1660 | if self.hashserv: | 1661 | if self.hashserv: |
1661 | self.hashserv.shutdown() | 1662 | self.hashserv.process.terminate() |
1663 | self.hashserv.process.join() | ||
1662 | bb.event.fire(CookerExit(), self.data) | 1664 | bb.event.fire(CookerExit(), self.data) |
1663 | 1665 | ||
1664 | def shutdown(self, force = False): | 1666 | def shutdown(self, force = False): |