Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race conditions in thin_replica_server_test.
This commit is intended to fix a couple race conditions previously observed in the thin_replica_server_test unit test suite in cases with names of the form SubscribeTo*EventGroup*WithGapTwoClients. The root cause of these race conditions was determined to be that these cases make calls to the test suite's addMoreEventGroups helper function in such a way that the addition of these event groups races with the TestStateMachine helper object's logic for detecting that all event group updates of interest to the test case have been streamed in order to end the subscription. This commit makes a couple changes to prevent the TestStateMachine from incorrectly detecting the end of a subscription that may be running concurrently with addMoreEventGroups calls. First, addMoreEventGroups's existing behavior included alerting the TestStateMachine that there are no more event groups to add with a call to TestStateMachine::toggle_more_event_groups_to_add(false). This commit adds a new optional bool parameter even_more_event_groups_to_add_after_these to addMoreEventGroups in order to allow test cases to avoid incorrectly notifying the TestStateMachine that there are no more event groups to add in cases where the test case will be making further calls to addMoreEventGroups after the current one. Second, this commit shifts the responsibility for calling TestStateMachine::set_expected_last_event_group_to_send from addMoreEventGroups to the actual test cases that call it so that the expected last event group to be sent can be correctly set strictly before the Thin Replica subscription begins running in order to avoid races between the final expected event group ID getting set correctly and the TestStateMachine checking updates the ThinReplicaImpl writes against this value. Additionally, this commit reactivates the affected test cases, as they were previously deactivated to avoid blocking other changes to improve Concord-BFT's and its CI's stability.
- Loading branch information