Skip to content

Commit

Permalink
Do not close the server transport in the dispatcher to force the agent
Browse files Browse the repository at this point in the history
to reconnect.  Just return an error - if an error is returned, the agent
will reconnect anyway - it seems like the transport closing was a way
to convince GRPC's load balancer to start reconnecting automatically.
See moby#797.

Signed-off-by: Ying Li <[email protected]>
  • Loading branch information
cyli committed May 29, 2018
1 parent 6a6993f commit 90418ad
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions manager/dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/grpc/transport"
)

const (
Expand Down Expand Up @@ -1268,16 +1267,6 @@ func (d *Dispatcher) Session(r *api.SessionRequest, stream api.Dispatcher_Sessio

// disconnectNode is a helper forcibly shutdown connection
disconnectNode := func() error {
// force disconnect by shutting down the stream.
transportStream, ok := transport.StreamFromContext(stream.Context())
if ok {
// if we have the transport stream, we can signal a disconnect
// in the client.
if err := transportStream.ServerTransport().Close(); err != nil {
log.WithError(err).Error("session end")
}
}

log.Infof("dispatcher session dropped, marking node %s down", nodeID)
if err := d.markNodeNotReady(nodeID, api.NodeStatus_DISCONNECTED, "node is currently trying to find new manager"); err != nil {
log.WithError(err).Error("failed to remove node")
Expand Down

0 comments on commit 90418ad

Please sign in to comment.