1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

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>
This commit is contained in:
Richard Purdie
2019-07-31 10:49:39 +01:00
parent d40d7e4385
commit 43d37a6eaf
3 changed files with 27 additions and 15 deletions
+4 -4
View File
@@ -6,7 +6,7 @@
#
import unittest
import threading
import multiprocessing
import sqlite3
import hashlib
import urllib.request
@@ -21,16 +21,16 @@ class TestHashEquivalenceServer(unittest.TestCase):
self.dbfile = tempfile.NamedTemporaryFile(prefix="bb-hashserv-db-")
self.server = create_server(('localhost', 0), self.dbfile.name)
self.server_addr = 'http://localhost:%d' % self.server.socket.getsockname()[1]
self.server_thread = threading.Thread(target=self.server.serve_forever)
self.server_thread = multiprocessing.Process(target=self.server.serve_forever)
self.server_thread.daemon = True
self.server_thread.start()
def tearDown(self):
# Shutdown server
s = getattr(self, 'server', None)
if s is not None:
self.server.shutdown()
self.server_thread.terminate()
self.server_thread.join()
self.server.server_close()
def send_get(self, path):
url = '%s/%s' % (self.server_addr, path)