Browse code

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 <solomon@docker.com>

Solomon Hykes authored on 2014/08/05 16:21:05
Showing 3 changed files
... ...
@@ -54,9 +54,6 @@ func remote(eng *engine.Engine) error {
54 54
 // These components should be broken off into plugins of their own.
55 55
 //
56 56
 func daemon(eng *engine.Engine) error {
57
-	if err := eng.Register("initserverpidfile", server.InitPidfile); err != nil {
58
-		return err
59
-	}
60 57
 	if err := eng.Register("initserver", server.InitServer); err != nil {
61 58
 		return err
62 59
 	}
... ...
@@ -46,14 +46,6 @@ func mainDaemon() {
46 46
 		log.Fatal(err)
47 47
 	}
48 48
 
49
-	// handle the pidfile early. https://github.com/docker/docker/issues/6973
50
-	if len(*pidfile) > 0 {
51
-		job := eng.Job("initserverpidfile", *pidfile)
52
-		if err := job.Run(); err != nil {
53
-			log.Fatal(err)
54
-		}
55
-	}
56
-
57 49
 	// load the daemon in the background so we can immediately start
58 50
 	// the http api so that connections don't fail while the daemon
59 51
 	// is booting
... ...
@@ -5,12 +5,9 @@
5 5
 package server
6 6
 
7 7
 import (
8
-	"fmt"
9
-
10 8
 	"github.com/docker/docker/daemon"
11 9
 	"github.com/docker/docker/daemonconfig"
12 10
 	"github.com/docker/docker/engine"
13
-	"github.com/docker/docker/utils"
14 11
 )
15 12
 
16 13
 func (srv *Server) handlerWrap(h engine.Handler) engine.Handler {
... ...
@@ -24,17 +21,6 @@ func (srv *Server) handlerWrap(h engine.Handler) engine.Handler {
24 24
 	}
25 25
 }
26 26
 
27
-func InitPidfile(job *engine.Job) engine.Status {
28
-	if len(job.Args) == 0 {
29
-		return job.Error(fmt.Errorf("no pidfile provided to initialize"))
30
-	}
31
-	job.Logf("Creating pidfile")
32
-	if err := utils.CreatePidFile(job.Args[0]); err != nil {
33
-		return job.Error(err)
34
-	}
35
-	return engine.StatusOK
36
-}
37
-
38 27
 // jobInitApi runs the remote api server `srv` as a daemon,
39 28
 // Only one api server can run at the same time - this is enforced by a pidfile.
40 29
 // The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.