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

routing: Improve first route load signaling #3473

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ponimas
Copy link
Member

@ponimas ponimas commented Apr 8, 2025

Dataclients may load routes with arbitrary delays. When multiple dataclients are used, it's possible that one dataclient loads routes multiple times while another doesn't load any routes at all. This could incorrectly signal that the first route has been loaded, even though the routing table only contains routes from a single dataclient.

This change fixes route update logic to signal first load only after routes from all configured dataclients are received at least once.

An alternative to #3447

Dataclients may load routes with arbitrary delays. When multiple
dataclients are used, it's possible that one dataclient loads routes
multiple times while another doesn't load any routes at all. This
could incorrectly signal that the first route has been loaded, even
though the routing table only contains routes from a single
dataclient.

This change fixes route update logic to signal first load only after
routes from all configured dataclients are received at least once.

An alternative to zalando#3447

Signed-off-by: Aleksandr Ponimaskin <[email protected]>
@ponimas ponimas added the bugfix Bug fixes and patches label Apr 8, 2025
@@ -96,6 +97,7 @@ func receiveFromClient(c DataClient, o Options, out chan<- *incomingData, quit <
continue
case initial || len(routes) > 0 || len(deletedIDs) > 0:
var incoming *incomingData
once.Do(firstLoad.Done)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a race condition - this will signal first load before actual table is updated (which happens around r.routeTable.Store(rt) )

You can play/test this by adding time.Sleep here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, tests are failing exactly because of this race.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Bug fixes and patches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants