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
Conversation
Please set the appropriate release note label. |
@Sen666666 Thank you for your PR. Do you have the golang's stack trace for this panic? |
@aanm yeap cilium-agent[25601]: panic: close of closed channel |
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.
@Sen666666 thanks for the stack trace. I think with a once.Do
will more readable.
@@ -623,5 +623,10 @@ 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 comment
The reason will be displayed to describe this comment to others. Learn more.
please use a Once.Do
here, it will guarantee that this call is only executed once. (The Once will be a field of nodeStore
.
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.
thanks for the suggestion, I will try to do some modification.
Regression introduced by #9888 |
use once.Do to make the check more readable |
When enable ipv4&ipv6 with crd ipam option, cilium panic after restoring old endpoint because of "close of closed channel" Use once.Do to make sure the close action only happen once. Signed-off-by: yangxingwu <yangxingwu@kuaishou.com> Signed-off-by: huangxuesen <huangxuesen@kuaishou.com>
test-me-please GKE failed with:
|
test-gke |
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.
Sorry for the regression introduced by me, I think we should ensure endpoints of both stacks are restored
@@ -623,5 +624,7 @@ func (a *crdAllocator) Dump() (map[string]string, string) { | |||
|
|||
// RestoreFinished marks the status of restoration as done | |||
func (a *crdAllocator) 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 both IPv6Allocator
and IPv4Allocator
are finished. They are called from here:
Lines 491 to 498 in 90b256e
if option.Config.IPAM == option.IPAMCRD || option.Config.IPAM == option.IPAMENI || option.Config.IPAM == option.IPAMAzure { | |
if option.Config.EnableIPv6 { | |
d.ipam.IPv6Allocator.RestoreFinished() | |
} | |
if option.Config.EnableIPv4 { | |
d.ipam.IPv4Allocator.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.
@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.
test-gke |
Merging despite GKE build being stuck because 1) GKE builds are not required to merge anymore, and 2) failure n-1 was flake #11117 and affected different test case than failure n-2. |
When enable ipv4&ipv6 with crd ipam option,cilium panic after restoring
old endpoint because of "close of closed channel"
We should check whether or not the channel has been closed, before we do
the action.
Signed-off-by: yangxingwu yangxingwu@kuaishou.com
Signed-off-by: huangxuesen huangxuesen@kuaishou.com