Skip to content

[17.03.x] Update containerd to 595e75c212d19a81d2b808a518fe1afc1391dad5#31662

Merged
justincormack merged 1 commit into
moby:17.03.xfrom
mlaventure:17.03-update-containerd
Mar 10, 2017
Merged

[17.03.x] Update containerd to 595e75c212d19a81d2b808a518fe1afc1391dad5#31662
justincormack merged 1 commit into
moby:17.03.xfrom
mlaventure:17.03-update-containerd

Conversation

@mlaventure

@mlaventure mlaventure commented Mar 8, 2017

Copy link
Copy Markdown
Contributor

Signed-off-by: Kenfe-Mickael Laventure mickael.laventure@gmail.com

--

Closes #31622, #31479, #31074
Closes #30984 (it's the second part of the fix :))

diff:

diff --git a/containerd/main.go b/containerd/main.go
index 568e453..68bdd8e 100644
--- a/containerd/main.go
+++ b/containerd/main.go
@@ -20,7 +20,7 @@ import (
 	"github.com/codegangsta/cli"
 	"github.com/cyberdelia/go-metrics-graphite"
 	"github.com/docker/containerd"
-	"github.com/docker/containerd/api/grpc/server"
+	grpcserver "github.com/docker/containerd/api/grpc/server"
 	"github.com/docker/containerd/api/grpc/types"
 	"github.com/docker/containerd/api/http/pprof"
 	"github.com/docker/containerd/supervisor"
@@ -159,6 +159,17 @@ func main() {
 func daemon(context *cli.Context) error {
 	s := make(chan os.Signal, 2048)
 	signal.Notify(s, syscall.SIGTERM, syscall.SIGINT)
+	// Split the listen string of the form proto://addr
+	listenSpec := context.String("listen")
+	listenParts := strings.SplitN(listenSpec, "://", 2)
+	if len(listenParts) != 2 {
+		return fmt.Errorf("bad listen address format %s, expected proto://address", listenSpec)
+	}
+	// Register server early to allow healthcheck to be done
+	server, err := startServer(listenParts[0], listenParts[1])
+	if err != nil {
+		return err
+	}
 	sv, err := supervisor.New(
 		context.String("state-dir"),
 		context.String("runtime"),
@@ -169,6 +180,7 @@ func daemon(context *cli.Context) error {
 	if err != nil {
 		return err
 	}
+	types.RegisterAPIServer(server, grpcserver.NewServer(sv))
 	wg := &sync.WaitGroup{}
 	for i := 0; i < 10; i++ {
 		wg.Add(1)
@@ -178,16 +190,6 @@ func daemon(context *cli.Context) error {
 	if err := sv.Start(); err != nil {
 		return err
 	}
-	// Split the listen string of the form proto://addr
-	listenSpec := context.String("listen")
-	listenParts := strings.SplitN(listenSpec, "://", 2)
-	if len(listenParts) != 2 {
-		return fmt.Errorf("bad listen address format %s, expected proto://address", listenSpec)
-	}
-	server, err := startServer(listenParts[0], listenParts[1], sv)
-	if err != nil {
-		return err
-	}
 	for ss := range s {
 		switch ss {
 		default:
@@ -199,7 +201,7 @@ func daemon(context *cli.Context) error {
 	return nil
 }
 
-func startServer(protocol, address string, sv *supervisor.Supervisor) (*grpc.Server, error) {
+func startServer(protocol, address string) (*grpc.Server, error) {
 	// TODO: We should use TLS.
 	// TODO: Add an option for the SocketGroup.
 	sockets, err := listeners.Init(protocol, address, "", nil)
@@ -211,7 +213,6 @@ func startServer(protocol, address string, sv *supervisor.Supervisor) (*grpc.Ser
 	}
 	l := sockets[0]
 	s := grpc.NewServer()
-	types.RegisterAPIServer(s, server.NewServer(sv))
 	healthServer := health.NewServer()
 	grpc_health_v1.RegisterHealthServer(s, healthServer)
 
diff --git a/supervisor/supervisor.go b/supervisor/supervisor.go
index 1c19339..e1fd5d6 100644
--- a/supervisor/supervisor.go
+++ b/supervisor/supervisor.go
@@ -331,7 +331,9 @@ func (s *Supervisor) restore() error {
 		id := d.Name()
 		container, err := runtime.Load(s.stateDir, id, s.shim, s.timeout)
 		if err != nil {
-			return err
+			logrus.WithFields(logrus.Fields{"error": err, "id": id}).Warnf("containerd: failed to load container,removing state directory.")
+			os.RemoveAll(filepath.Join(s.stateDir, id))
+			continue
 		}
 		processes, err := container.Processes()
 		if err != nil {

@mlaventure mlaventure added this to the 17.03.1 milestone Mar 8, 2017
@cpuguy83

cpuguy83 commented Mar 9, 2017

Copy link
Copy Markdown
Member
Conflicting files
hack/dockerfile/binaries-commits

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
@mlaventure mlaventure force-pushed the 17.03-update-containerd branch from 5dde43e to 74c52a7 Compare March 9, 2017 21:50
@mlaventure

Copy link
Copy Markdown
Contributor Author

Updated

@cpuguy83 cpuguy83 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vdemeester vdemeester left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐸

@justincormack

Copy link
Copy Markdown
Contributor

ignoring P&Z as jenkins wired up wrong and we cant see output, so merging.

@justincormack justincormack merged commit 4bd1b71 into moby:17.03.x Mar 10, 2017
@thaJeztah thaJeztah changed the title Update containerd to 595e75c212d19a81d2b808a518fe1afc1391dad5 [17.03.x] Update containerd to 595e75c212d19a81d2b808a518fe1afc1391dad5 Mar 13, 2017
runcom added a commit to projectatomic/containerd that referenced this pull request Jan 19, 2018
moby/moby#31662
moby/moby#31852

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
runcom added a commit to projectatomic/containerd that referenced this pull request Jan 19, 2018
moby/moby#31662
moby/moby#31852

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
runcom added a commit to projectatomic/containerd that referenced this pull request Jan 19, 2018
moby/moby#31662
moby/moby#31852

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants