hashserv: Fix read-only mode
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 hashserv: Fix read-only mode
TCP read-only hash equivalence server is not working: the connection is prematurely closed without even notifying the value of the unihash. Expected behaviour is:
1. the client sends a ‘report’ message indicating the 'taskhash', 'method', 'outhash' and a proposed value of 'unihash'. 2.the server sends back the 'taskhash', 'method' and actual value of 'unihash' to use.
The problem is that in read-only mode, the server rejects 'report' messages (connexion is closed). hashserv.tests.TestHashEquivalenceUnixServer.test_ro_server test modified accordingly
--- bitbake/lib/hashserv/server.py | 14 +++++++------- bitbake/lib/hashserv/tests.py | 4 +--- 2 files changed, 8 insertions(+), 10 deletions(-)
bitbake/lib/hashserv/server.py +7 -7
@@ -181,7 +181,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): }) if read_only: - self.handlers.update({ + self.handlers.update({ 'report': self.handle_readonly_report, }) else:
@@ -469,7 +469,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): for k in ('owner', 'PN', 'PV', 'PR', 'task', 'outhash_siginfo'): if k in data: - outhash_data[k] = data[k] + outhash_data[k] = data[k] # Check if outhash is known cursor.execute(
@@ -489,13 +489,13 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): } ) row = cursor.fetchone() - if row is not None: + if row is not None: # outhash is known => corrects unihash - unihash = row['unihash'] + unihash = row['unihash'] else: # outhash is unknown => nothing to do - unihash = outhash_data['taskhash'] - + unihash = outhash_data['taskhash'] + d = { 'taskhash': data['taskhash'],
@@ -504,7 +504,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): } self.write_message(d) - + async def handle_equivreport(self, data): with closing(self.db.cursor()) as cursor:
bitbake/lib/hashserv/tests.py +1 -3
@@ -312,13 +312,11 @@ class HashEquivalenceCommonTests(object): # Check the hash via the read-only server self.assertClientGetHash(ro_client, taskhash, unihash) - # Karim removed : # Ensure that reporting via the read-only server fails - # Karim added : # Ensure that reporting via the read-only server doesn't modify the database + # Ensure that reporting via the read-only server doesn't modify the database taskhash2 = 'c665584ee6817aa99edfc77a44dd853828279370' outhash2 = '3c979c3db45c569f51ab7626a4651074be3a9d11a84b1db076f5b14f7d39db44' unihash2 = '90e9bc1d1f094c51824adca7f8ea79a048d68824' - # Karim removed : with self.assertRaises(ConnectionError): ro_client.report_unihash(taskhash2, self.METHOD, outhash2, unihash2) # Ensure that the database was not modified
Signature · 1 line
2.25.1
Hello,
This doesn't apply on bitbake master, can you rebase and fix?
Quoted 94 lines · Karim
TCP read-only hash equivalence server is not working: the connection is prematurely closed without even notifying the value of the unihash. Expected behaviour is:
1. the client sends a ‘report’ message indicating the 'taskhash', 'method', 'outhash' and a proposed value of 'unihash'. 2.the server sends back the 'taskhash', 'method' and actual value of 'unihash' to use.
The problem is that in read-only mode, the server rejects 'report' messages (connexion is closed). hashserv.tests.TestHashEquivalenceUnixServer.test_ro_server test modified accordinglySigned-off-by Karim Ben Houcine <[email protected]>--- bitbake/lib/hashserv/server.py | 14 +++++++------- bitbake/lib/hashserv/tests.py | 4 +--- 2 files changed, 8 insertions(+), 10 deletions(-)bitbake/lib/hashserv/server.py +7
-7@@ -181,7 +181,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): }) if read_only: - self.handlers.update({ + self.handlers.update({ 'report': self.handle_readonly_report, }) else:@@ -469,7 +469,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): for k in ('owner', 'PN', 'PV', 'PR', 'task', 'outhash_siginfo'): if k in data: - outhash_data[k] = data[k] + outhash_data[k] = data[k] # Check if outhash is known cursor.execute(@@ -489,13 +489,13 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): } ) row = cursor.fetchone() - if row is not None: + if row is not None: # outhash is known => corrects unihash - unihash = row['unihash'] + unihash = row['unihash'] else: # outhash is unknown => nothing to do - unihash = outhash_data['taskhash'] - + unihash = outhash_data['taskhash'] + d = { 'taskhash': data['taskhash'],@@ -504,7 +504,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): } self.write_message(d) - + async def handle_equivreport(self, data): with closing(self.db.cursor()) as cursor:bitbake/lib/hashserv/tests.py +1
-3@@ -312,13 +312,11 @@ class HashEquivalenceCommonTests(object): # Check the hash via the read-only server self.assertClientGetHash(ro_client, taskhash, unihash) - # Karim removed : # Ensure that reporting via the read-only server fails - # Karim added : # Ensure that reporting via the read-only server doesn't modify the database + # Ensure that reporting via the read-only server doesn't modify the database taskhash2 = 'c665584ee6817aa99edfc77a44dd853828279370' outhash2 = '3c979c3db45c569f51ab7626a4651074be3a9d11a84b1db076f5b14f7d39db44' unihash2 = '90e9bc1d1f094c51824adca7f8ea79a048d68824' - # Karim removed : with self.assertRaises(ConnectionError): ro_client.report_unihash(taskhash2, self.METHOD, outhash2, unihash2) # Ensure that the database was not modifiedSignature · 11 lines
2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#15155): https://lists.openembedded.org/g/bitbake-devel/message/15155 Mute This Topic: https://lists.openembedded.org/mt/101709922/3617179 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com