source.Channel ignoring event #942
Labels
help wanted
Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
kind/bug
Categorizes issue or PR as related to a bug.
priority/important-soon
Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Milestone
Hello, I'm using
source.Channel
to do an artificial initial reconciliation followed by periodic cycles, and have noticed that sometimes the initial request is ignored.Did some investigation and looks like a race condition where the events are processed before the Channel has any targets.
In particular this goroutine is started,
controller-runtime/pkg/source/source.go
Lines 194 to 197 in c2dfe1a
before,
controller-runtime/pkg/source/source.go
Line 219 in c2dfe1a
Here,
syncLoop()
callsdistribute()
who sends the event to every channel oncs.dest
. So it can happen that thatsyncLoop()
processes an event, beforecs.dest
is initialized, so it doesn't get processed by anyone.As for a fix, I'd suggest starting the goroutine after
cs.dest
is set instead. I can create a PR as well if preferred.This was seen on controller-runtime v0.5.2, but looking at the code, it seems to also apply to master.
Best regards,
Luis
The text was updated successfully, but these errors were encountered: