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 race: Make informed watcher start wait for Add event 🏎️ #2036

Merged
merged 2 commits into from
Mar 2, 2021

Commits on Mar 2, 2021

  1. Fix race: Make informed watcher start wait for Add event 🏎️

    When using the informed watcher to watch a config map, previously add
    events were being processed in a goroutine with no syncrhonization
    making it so that code may try to access the values backed by the
    configmaps before they are initialized.
    
    This commit makes it so that the Start method of the informer will wait
    for the add event to occur at least once for all config maps it is
    watching.
    
    This commit also undoes the workaround added in knative#1929 which was working
    around the race condition identified in knative#1907 (and in
    tektoncd/pipeline#3720). This means that if
    the synchronization was removed, the impacted test would start flaking
    again. If we wanted it to reliably fail in that case, we could introduce
    a sleep in the callback but that doesn't seem worth it.
    
    I also tested this change by manually patching the changes into my
    clone of tektoncd/pipeline and following the repro steps at
    tektoncd/pipeline#2815 (comment)
    Before the change I can reproduce the issue, and after the change, I
    can't! :D
    
    Fixes knative#1960
    bobcatfish committed Mar 2, 2021
    Configuration menu
    Copy the full SHA
    a70d600 View commit details
    Browse the repository at this point in the history
  2. Make synced callback and named wait group private 🕵️

    These utility objects don't really make sense to expose as part of the
    informed watcher package and are only used by the informed watcher.
    Writing tests for unexported code makes me a bit :( but hopefully these
    will get moved to some other package one day. And there's really no
    reason to expose these to users of knative/pkg at the moment.
    bobcatfish committed Mar 2, 2021
    Configuration menu
    Copy the full SHA
    572b926 View commit details
    Browse the repository at this point in the history