From b4efcd53e0a62a8ce1080e94e28358ac1a2d6ae2 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 5 Aug 2014 07:21:05 +0000 Subject: [PATCH] Remove unnecessary job "initserverpidfile" That job was a hacky solution to a real race condition. This removes the hack without re-introducing the race. Signed-off-by: Solomon Hykes --- builtins/builtins.go | 3 --- docker/daemon.go | 8 -------- server/init.go | 14 -------------- 3 files changed, 25 deletions(-) diff --git a/builtins/builtins.go b/builtins/builtins.go index 75f9d4ce34..ea1e7c6b84 100644 --- a/builtins/builtins.go +++ b/builtins/builtins.go @@ -54,9 +54,6 @@ func remote(eng *engine.Engine) error { // These components should be broken off into plugins of their own. // func daemon(eng *engine.Engine) error { - if err := eng.Register("initserverpidfile", server.InitPidfile); err != nil { - return err - } if err := eng.Register("initserver", server.InitServer); err != nil { return err } diff --git a/docker/daemon.go b/docker/daemon.go index caaf94e06d..15d9c4856f 100644 --- a/docker/daemon.go +++ b/docker/daemon.go @@ -46,14 +46,6 @@ func mainDaemon() { log.Fatal(err) } - // handle the pidfile early. https://github.com/docker/docker/issues/6973 - if len(*pidfile) > 0 { - job := eng.Job("initserverpidfile", *pidfile) - if err := job.Run(); err != nil { - log.Fatal(err) - } - } - // load the daemon in the background so we can immediately start // the http api so that connections don't fail while the daemon // is booting diff --git a/server/init.go b/server/init.go index f815b8e61b..f389fd4f38 100644 --- a/server/init.go +++ b/server/init.go @@ -5,12 +5,9 @@ package server import ( - "fmt" - "github.com/docker/docker/daemon" "github.com/docker/docker/daemonconfig" "github.com/docker/docker/engine" - "github.com/docker/docker/utils" ) func (srv *Server) handlerWrap(h engine.Handler) engine.Handler { @@ -24,17 +21,6 @@ func (srv *Server) handlerWrap(h engine.Handler) engine.Handler { } } -func InitPidfile(job *engine.Job) engine.Status { - if len(job.Args) == 0 { - return job.Error(fmt.Errorf("no pidfile provided to initialize")) - } - job.Logf("Creating pidfile") - if err := utils.CreatePidFile(job.Args[0]); err != nil { - return job.Error(err) - } - return engine.StatusOK -} - // jobInitApi runs the remote api server `srv` as a daemon, // Only one api server can run at the same time - this is enforced by a pidfile. // The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.