From 7a6412cb0b4e52bf175a77b5f43d4a74547e9798 Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Wed, 3 Oct 2018 11:48:30 -0700 Subject: [PATCH] runsc: Allow state transition from Creating to Stopped. This can happen if an error is encountered during Create() which causes the container to be destroyed and set to state Stopped. Without this transition, errors during Create get hidden by the later panic. PiperOrigin-RevId: 215599193 Change-Id: Icd3f42e12c685cbf042f46b3929bccdf30ad55b0 --- runsc/container/container.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runsc/container/container.go b/runsc/container/container.go index 4b0037b4e..827528349 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -771,7 +771,7 @@ func (c *Container) changeStatus(s Status) { } case Stopped: - if c.Status != Created && c.Status != Running && c.Status != Stopped { + if c.Status != Creating && c.Status != Created && c.Status != Running && c.Status != Stopped { panic(fmt.Sprintf("invalid state transition: %v => %v", c.Status, s)) }