Skip to content

Commit

Permalink
Fix race condition waiting for rounds. (#3099)
Browse files Browse the repository at this point in the history
## 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
#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:
#3100
- Bug was introduced/revealed in:
#2961
- [reviewer
checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
  • Loading branch information
afck authored Jan 8, 2025
1 parent 5e2cf7e commit b9c5fcd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions linera-client/src/client_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand Down

0 comments on commit b9c5fcd

Please sign in to comment.