Skip to content
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

Do not create new addrConn when connection error happens #1369

Merged
merged 2 commits into from
Jul 20, 2017

Conversation

menghanl
Copy link
Contributor

Just reset the underlying transport instead.

clientconn.go Outdated
select {
case <-t.Error():
ac.cc.resetAddrConn(ac.addr, false, errNetworkIO)
if err := ac.resetTransport(false); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor?

var drain bool
select {
  case <-t.Error():
  default:
    drain = true
}
if err := ac.resetTransport(drain); err != nil {
...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. PTAL.

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple comment nits.

clientconn.go Outdated
// 2) goaway was received, a new ac will replace the old ac.
// The old ac should be deleted from cc.conns, but the
// underlying transport should drain rather than close.
// a buggy Balancer notifies duplicated Addresses;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a buggy Balancer that reports duplicate Addresses."

clientconn.go Outdated
@@ -949,28 +949,22 @@ func (ac *addrConn) transportMonitor() {
ac.adjustParams(t.GetGoAwayReason())
// If GoAway happens without any network I/O error, the underlying transport
// will be gracefully closed, and a new transport will be created.
// (the transport will be closed when all the pending RPCs finished or failed.).
// (the transport will be closed when all the pending RPCs finished or failed.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capital "T" at the start of the sentence.

@menghanl menghanl merged commit 98eab9b into grpc:master Jul 20, 2017
@menghanl menghanl deleted the addrConn_redo_for_balancer branch July 20, 2017 20:23
gyuho added a commit to gyuho/etcd that referenced this pull request Aug 1, 2017
Fix etcd-io#8329.

Different behavior from grpc/grpc-go#1369,
in grpc-go transportMonitor.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
visheshnp pushed a commit to visheshnp/etcd that referenced this pull request Aug 3, 2017
Fix etcd-io#8329.

Different behavior from grpc/grpc-go#1369,
in grpc-go transportMonitor.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
@dfawley dfawley modified the milestone: 1.6 Release Aug 28, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants