From b9c5fcd9481b9c7d8be5e94cdf1a8e0a0aa6bcf1 Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Wed, 8 Jan 2025 15:12:37 +0100 Subject: [PATCH] Fix race condition waiting for rounds. (#3099) ## Motivation `test_end_to_end_listen_for_new_rounds::storage_test_service_grpc` is flaky for me locally and sometimes hangs, even though it seems fine on CI. The logs suggest that the two clients are both waiting for round notifications forever, even though one of them should be the leader in the current round. ## Proposal Adding an explicit `prepare_chain` fixes the issue. It's not quite clear why this is necessary, so I created https://github.com/linera-io/linera-protocol/issues/3100. ## Test Plan Running the test in a loop locally failed quite often. With this change it passed 50 times in a row. ## Release Plan - Nothing to do / These changes follow the usual release cycle. ## Links - Issue to revisit this: https://github.com/linera-io/linera-protocol/issues/3100 - Bug was introduced/revealed in: https://github.com/linera-io/linera-protocol/pull/2961 - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist) --- linera-client/src/client_context.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/linera-client/src/client_context.rs b/linera-client/src/client_context.rs index b4d4c01d2d1..887ec93aaa8 100644 --- a/linera-client/src/client_context.rs +++ b/linera-client/src/client_context.rs @@ -435,6 +435,7 @@ where loop { // Try applying f. Return if committed. + client.prepare_chain().await?; let result = f(client).await; self.update_and_save_wallet(client).await?; let timeout = match result? {