-
Notifications
You must be signed in to change notification settings - Fork 187
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
Added debug to apparent stop channel called early. #687
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cheftako 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 |
/test pull-apiserver-network-proxy-test-master |
/assign @tallclair |
select { | ||
case <-a.stopCh: | ||
return | ||
default: | ||
} | ||
timeout := time.Now().Add(15 * time.Second) | ||
eConn.conn.SetReadDeadline(timeout) |
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 think what we want to do here is close the connection if stopch is closed. Something like this?
go func() {
<-a.stopCh
eConn.conn.Close()
}
The documentation on Close says it terminates any blocking read or write operations.
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.
This function has a defer cleanup() call on line 533. When we return it should get called. That cleanup makes a protected call to
apiserver-network-proxy/pkg/agent/client.go
Line 386 in c1a1e09
eConn.cleanFunc = func() { |
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.
Is it a problem to call close()
multiple times? I wasn't suggesting that we were leaving the connection open, but rather calling close should be a way to quickly react to the stop channel, rather than polling for it every 15 seconds, which is what I understood your change to be doing?
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 don't believe close in golang is re-entrant. In fact I think the reason we had to protect the clean up with callOnce() in that code path is specifically because close causes a panic if called twice.
No description provided.