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
daemon: Fix the "close of closed channel" panic #11056
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,8 @@ type nodeStore struct { | |
allocationPoolSize map[Family]int | ||
|
||
// signal for completion of restoration | ||
restoreFinished chan bool | ||
restoreFinished chan bool | ||
restoreCloseOnce sync.Once | ||
|
||
conf Configuration | ||
} | ||
|
@@ -623,5 +624,7 @@ func (a *crdAllocator) Dump() (map[string]string, string) { | |
|
||
// RestoreFinished marks the status of restoration as done | ||
func (a *crdAllocator) RestoreFinished() { | ||
close(a.store.restoreFinished) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for the suggestion, I will try to do some modification. |
||
a.store.restoreCloseOnce.Do(func() { | ||
close(a.store.restoreFinished) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The aim here is to restore all endpoints before triggering sync with upstream, so I think we should close
a.store.restoreFinished
only after the restoration of bothIPv6Allocator
andIPv4Allocator
are finished. They are called from here:cilium/daemon/cmd/daemon.go
Lines 491 to 498 in 90b256e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaffcheng @Sen666666 Looking at the code, this comment seems to be a potential further fix that should go in at some point, but does not directly interact with this specific PR #11056 that just fixes a specific crash issue. I'd like to merge this PR as-is to fix the crash, then you can follow up to address these comments. Does that sound reasonable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's address this comment in a follow-up PR.