Skip to content

Commit a0a7f6f

Browse files
Aaron Lehmanncyli
authored andcommitted
manager: Always run the watch server
The watch server was wrongly changed to only run on the leader node. It needs to run on all managers because this is one of the RPC services that is not proxied to the leader (since all nodes receive events through Raft). Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com> (cherry picked from commit 80abd93)
1 parent 3a5ee2b commit a0a7f6f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

manager/manager.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,10 @@ func (m *Manager) Run(parent context.Context) error {
490490
healthServer.SetServingStatus("Raft", api.HealthCheckResponse_NOT_SERVING)
491491
localHealthServer.SetServingStatus("ControlAPI", api.HealthCheckResponse_NOT_SERVING)
492492

493+
if err := m.watchServer.Start(ctx); err != nil {
494+
log.G(ctx).WithError(err).Error("watch server failed to start")
495+
}
496+
493497
go m.serveListener(ctx, m.remoteListener)
494498
go m.serveListener(ctx, m.controlListener)
495499

@@ -565,8 +569,8 @@ func (m *Manager) Run(parent context.Context) error {
565569
const stopTimeout = 8 * time.Second
566570

567571
// Stop stops the manager. It immediately closes all open connections and
568-
// active RPCs as well as stopping the scheduler. If clearData is set, the
569-
// raft logs, snapshots, and keys will be erased.
572+
// active RPCs as well as stopping the manager's subsystems. If clearData is
573+
// set, the raft logs, snapshots, and keys will be erased.
570574
func (m *Manager) Stop(ctx context.Context, clearData bool) {
571575
log.G(ctx).Info("Stopping manager")
572576
// It's not safe to start shutting down while the manager is still
@@ -600,6 +604,7 @@ func (m *Manager) Stop(ctx context.Context, clearData bool) {
600604

601605
m.dispatcher.Stop()
602606
m.logbroker.Stop()
607+
m.watchServer.Stop()
603608
m.caserver.Stop()
604609

605610
if m.allocator != nil {
@@ -1005,10 +1010,6 @@ func (m *Manager) becomeLeader(ctx context.Context) {
10051010
log.G(ctx).WithError(err).Error("LogBroker failed to start")
10061011
}
10071012

1008-
if err := m.watchServer.Start(ctx); err != nil {
1009-
log.G(ctx).WithError(err).Error("watch server failed to start")
1010-
}
1011-
10121013
go func(server *ca.Server) {
10131014
if err := server.Run(ctx); err != nil {
10141015
log.G(ctx).WithError(err).Error("CA signer exited with an error")
@@ -1061,7 +1062,6 @@ func (m *Manager) becomeLeader(ctx context.Context) {
10611062
func (m *Manager) becomeFollower() {
10621063
m.dispatcher.Stop()
10631064
m.logbroker.Stop()
1064-
m.watchServer.Stop()
10651065
m.caserver.Stop()
10661066

10671067
if m.allocator != nil {

0 commit comments

Comments
 (0)