Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: garbage collection test race condition #904

Merged
merged 6 commits into from
Sep 19, 2023

Conversation

dennis-tra
Copy link
Contributor

@dennis-tra dennis-tra commented Sep 18, 2023

Moved ticker initialization outside the garbage collection goroutine. There was a race condition between advancing the mocked time in TestProvidersBackend_GarbageCollection and the initialization of the ticker that triggers the garbage collection runs. It happened that we were advancing the time without the ticker being initialized. Hence, advancing the time hasn't had any effect.

In this PR, I moved the ticker initialization outside the garbage collection goroutine. This means the ticker will be registered with the MockClock object after StartGarbageCollection returns. Calls to mockClock.Add will therefore trigger the ticker.

@dennis-tra dennis-tra changed the base branch from master to v2-coord-addr September 18, 2023 19:05
@dennis-tra dennis-tra marked this pull request as ready for review September 18, 2023 19:05
@dennis-tra dennis-tra force-pushed the v2-coord-addr-gc-failing-test branch 3 times, most recently from 4c6011e to 817ca58 Compare September 19, 2023 07:40
@dennis-tra dennis-tra changed the title tmp: here to run CI - V2 coord addr gc failing test fix: garbage collection test race condition Sep 19, 2023
@dennis-tra dennis-tra merged commit e294795 into v2-coord-addr Sep 19, 2023
11 checks passed
@dennis-tra dennis-tra deleted the v2-coord-addr-gc-failing-test branch September 19, 2023 08:31
iand added a commit that referenced this pull request Sep 19, 2023
* Decouple coord package from addressing

* Go fmt

* fix: garbage collection test race condition (#904)

Moved ticker initialization outside the garbage collection goroutine. There was a race condition between advancing the mocked time in TestProvidersBackend_GarbageCollection and the initialization of the ticker that triggers the garbage collection runs. It happened that we were advancing the time without the ticker being initialized. Hence, advancing the time hasn't had any effect.

In this PR, I moved the ticker initialization outside the garbage collection goroutine. This means the ticker will be registered with the MockClock object after StartGarbageCollection returns. Calls to mockClock.Add will therefore trigger the ticker.

* Fix test flakes that wait for routing events (#905)

* Increase test iterations to trigger flake

* Add failfast

* Replace routing notification channel with a RoutingNotifier type

* Remove unused code

* Remove test count

---------

Co-authored-by: Dennis Trautwein <git@dtrautwein.eu>
@dennis-tra dennis-tra added the v2 All issues related to the v2 rewrite label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 All issues related to the v2 rewrite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants