Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
engine: fix a bug in engine being unreachable
Browse files Browse the repository at this point in the history
When gRPC turned on, TestScheduleMachineOf fails sometimes, as the
engine becomes unreachable with the following error messages:

====
transport: http2Client. notifyError got notified that the client transport was broken EOF.
ERROR registrymux.go:166: Retry to connect to new engine: dial tcp 172.18.1.1:50059: getsockopt: connection refused
ERROR registrymux.go:166: Retry to connect to new engine: dial tcp 172.18.1.1:50059: getsockopt: connection refused
ERROR registrymux.go:166: Retry to connect to new engine: dial tcp 172.18.1.1:50059: getsockopt: connection refused
====

This must have been a regression from commit ecb121a ("registry/rpc: use
simpleBalancer instead of ClientConn.State()"). Remove the additional
checking with IsRegistryReady, in order to avoid the occasional case of
engine being unreachable.

Fixes #1712
  • Loading branch information
Dongsu Park committed Dec 2, 2016
1 parent f44f123 commit 278949a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions engine/rpcengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@ func rpcAcquireLeadership(reg registry.Registry, lManager lease.Manager, machID
return l
}

// If reg is not ready, we have to give it an opportunity to steal lease
// below. Otherwise it could be blocked forever by the existing engine leader,
// which could cause gRPC registry to always fail when a leader already exists.
// Thus we return the existing leader, only if reg.IsRegistryReady() == true.
// TODO(dpark): refactor the entire function for better readability. - 20160908
if (existing != nil && existing.Version() >= ver) && reg.IsRegistryReady() {
if existing != nil && existing.Version() >= ver {
log.Debugf("Lease already held by Machine(%s) operating at acceptable version %d", existing.MachineID(), existing.Version())
return existing
}
Expand Down

0 comments on commit 278949a

Please sign in to comment.