From ab54d2c416220eae8c334c816d458d4979b959d3 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 19 Jan 2020 14:00:59 -0800 Subject: [PATCH] Avoid triggering crash detection on container destroy --- http.go | 1 + server/environment_docker.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/http.go b/http.go index 76a0699..7cc4cd9 100644 --- a/http.go +++ b/http.go @@ -501,6 +501,7 @@ func (rt *Router) routeServerDelete(w http.ResponseWriter, r *http.Request, ps h // to start it while this process is running. s.Suspended = true + zap.S().Infow("processing server deletion request", zap.String("server", s.Uuid)) // Destroy the environment; in Docker this will handle a running container and // forcibly terminate it before removing the container, so we do not need to handle // that here. diff --git a/server/environment_docker.go b/server/environment_docker.go index e7a26f9..694a2a3 100644 --- a/server/environment_docker.go +++ b/server/environment_docker.go @@ -292,6 +292,9 @@ func (d *DockerEnvironment) Terminate(signal os.Signal) error { func (d *DockerEnvironment) Destroy() error { ctx := context.Background() + // Avoid crash detection firing off. + d.Server.SetState(ProcessStoppingState) + return d.Client.ContainerRemove(ctx, d.Server.Uuid, types.ContainerRemoveOptions{ RemoveVolumes: true, RemoveLinks: false,