-
Notifications
You must be signed in to change notification settings - Fork 382
channel neither has values in nor be closed . #2547
Conversation
Hi @wayilau. Thanks for your PR. I'm waiting for a kubernetes-incubator or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
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.
not sure why I got an email, I don't think I'm subscribed anymore.
@@ -35,7 +36,7 @@ func RunServer(opts *ServiceCatalogServerOptions, stopCh <-chan struct{}) error | |||
if stopCh == nil { | |||
/* the caller of RunServer should generate the stop channel | |||
if there is a need to stop the API server */ | |||
stopCh = make(chan struct{}) | |||
stopCh = server.SetupSignalHandler() |
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.
should check the callers of this and make sure they're supplying a channel.
My guess is that there is the cli/cmd , and tests.
We should probably crash if this isn't set, but I haven't looked close enough to know.
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 will have a look about this. thank you for your review @MHBauer
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.
Have you looked into this? what happens when it isn't set?
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, i was busy these days. i Will have a look it today or tomorrow.
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.
@jberkhahn the caller give a channel actually, which created by server.SetupSignalHandler().
but if stopCh == nil, just make one can not be closed at all. so i give the code above.
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.
from that description, I think this should panic and crash with an informative message.
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.
@MHBauer i modify the code to "panic", also give a message when the stop channel was not set. Please help review it when you are idle.
/retest |
Add Tests for this case.
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.
fix the comment and the code can go in as it is.
/approve
/hold
if there is a need to stop the API server */ | ||
stopCh = make(chan struct{}) | ||
/* whe RespectsStopCh: true and the stop channel is nil, error returned*/ | ||
return fmt.Errorf("%v", "the stop channel can not be nil") |
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.
An error is good enough, but I still think this should be a panic. it's unreachable in normal case. If someone is going to library-ize this code and use it in their own apiserver, they need to know to set it.
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, i will change the code.
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.
@MHBauer i've changed the code comment as it is.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MHBauer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@MHBauer @jberkhahn |
I'm fine with this |
/lgtm |
* channel neither has values in nor be closed . * panic api server when stop channel not set * Return Error when the stop channel is nil and RespectsStopCh=true Add Tests for this case.
This PR is a
What this PR does / why we need it:
channel never closed when create a new one by "make", but also has no values in it.