-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
apiserver: Update genericapiserver to panic on listener error #42272
Conversation
|
||
err := server.Serve(listener) | ||
|
||
stopRequested := strings.Contains(err.Error(), "use of closed network connection") |
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.
why not keep the old logic with the channel? This looks fishy to compare error texts.
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.
definitely don't check error text that drifts between releases
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.
Done.
|
||
stopRequested := strings.Contains(err.Error(), "use of closed network connection") | ||
if stopRequested { | ||
glog.Info("Stop requested") |
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.
Would be a bit more verbose: Stop listening for network connection on ...
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.
Done.
|
||
err := server.Serve(listener) | ||
|
||
stopRequested := strings.Contains(err.Error(), "use of closed network connection") |
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.
definitely don't check error text that drifts between releases
if stopRequested { | ||
glog.Info("Stop requested") | ||
} else { | ||
panic(fmt.Sprintf("Stopping due to error: %v", err)) |
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.
still expected a HandleCrash call
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.
Done.
When I looked at HandleCrash
and it didn't seem necessary anymore:
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.
there is dispute over that TODO
if stopRequested { | ||
glog.Info("Stop requested") | ||
} else { | ||
panic(fmt.Sprintf("Stopping due to error: %v", err)) |
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.
As we have two listeners potentially add the addr here.
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.
Done.
ln.Close() | ||
}() | ||
|
||
go func() { | ||
defer utilruntime.HandleCrash() |
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.
What happens on panic of the go-routine now? Will apiserver terminate or will the socket stay bound, but nobody listens anymore for incoming connections?
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.
I've added this back as per @liggitt. I misread a comment on HandleCrash
that suggested it might no longer be necessary.
e0cbf12
to
0da4be0
Compare
@k8s-bot test this |
lgtm |
/approve |
@sttts: you can't LGTM a PR unless you are an assignee. In response to this comment:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm |
This PR is also useful for #42224 ( |
@k8s-bot kops aws e2e test this |
0da4be0
to
462b6aa
Compare
rebased |
Previously runServer would try to listen again if a listener error occurred. This commit changes the response to a panic to allow a process manager (systemd/kubelet/etc) to react to the failure.
462b6aa
to
30fb3be
Compare
rebased |
@sttts tests are passing again! |
/lgtm |
Automatic merge from submit-queue |
Previously runServer would try to listen again if a listener error occurred. This commit changes the response to a panic to allow a process manager (systemd/kubelet/etc) to react to the failure.
Release note:
cc: @liggitt @sttts @deads2k @derekwaynecarr