From 9f13b414b90ee8ae36abdbce6a9089b8da717bd4 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Thu, 3 Aug 2017 17:09:16 -0400 Subject: [PATCH] Return exit status from Wait of stopped process This changes Wait() from returning an error whenever you call wait on a stopped process/task to returning the exit status from the process. This also adds the exit status to the Status() call on a process/task so that a user can Wait(), check status, then cancel the wait to avoid races in event handling. Signed-off-by: Michael Crosby --- api/types/task/task.pb.go | 91 +++++++++++++------ api/types/task/task.proto | 2 + checkpoint_test.go | 2 +- cmd/ctr/delete.go | 2 +- container_test.go | 20 ++--- linux/process.go | 16 ++-- linux/shim/service.go | 19 ++-- linux/shim/v1/shim.pb.go | 182 ++++++++++++++++++++++---------------- linux/shim/v1/shim.proto | 1 + linux/task.go | 15 ++-- process.go | 15 +++- runtime/task.go | 14 +-- services/tasks/service.go | 17 ++-- task.go | 33 ++++--- windows/process.go | 13 +-- windows/task.go | 19 ++-- 16 files changed, 283 insertions(+), 178 deletions(-) diff --git a/api/types/task/task.pb.go b/api/types/task/task.pb.go index cc9bb847f..6257cac7c 100644 --- a/api/types/task/task.pb.go +++ b/api/types/task/task.pb.go @@ -43,6 +43,7 @@ const ( StatusRunning Status = 2 StatusStopped Status = 3 StatusPaused Status = 4 + StatusPausing Status = 5 ) var Status_name = map[int32]string{ @@ -51,6 +52,7 @@ var Status_name = map[int32]string{ 2: "RUNNING", 3: "STOPPED", 4: "PAUSED", + 5: "PAUSING", } var Status_value = map[string]int32{ "UNKNOWN": 0, @@ -58,6 +60,7 @@ var Status_value = map[string]int32{ "RUNNING": 2, "STOPPED": 3, "PAUSED": 4, + "PAUSING": 5, } func (x Status) String() string { @@ -74,6 +77,7 @@ type Process struct { Stdout string `protobuf:"bytes,6,opt,name=stdout,proto3" json:"stdout,omitempty"` Stderr string `protobuf:"bytes,7,opt,name=stderr,proto3" json:"stderr,omitempty"` Terminal bool `protobuf:"varint,8,opt,name=terminal,proto3" json:"terminal,omitempty"` + ExitStatus uint32 `protobuf:"varint,9,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` } func (m *Process) Reset() { *m = Process{} } @@ -149,6 +153,11 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) { } i++ } + if m.ExitStatus != 0 { + dAtA[i] = 0x48 + i++ + i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) + } return i, nil } @@ -211,6 +220,9 @@ func (m *Process) Size() (n int) { if m.Terminal { n += 2 } + if m.ExitStatus != 0 { + n += 1 + sovTask(uint64(m.ExitStatus)) + } return n } @@ -240,6 +252,7 @@ func (this *Process) String() string { `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `}`, }, "") return s @@ -484,6 +497,25 @@ func (m *Process) Unmarshal(dAtA []byte) error { } } m.Terminal = bool(v != 0) + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTask(dAtA[iNdEx:]) @@ -615,33 +647,34 @@ func init() { } var fileDescriptorTask = []byte{ - // 436 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x3f, 0x6f, 0xd3, 0x40, - 0x18, 0xc6, 0x73, 0x4e, 0xeb, 0x84, 0xeb, 0x1f, 0xcc, 0x51, 0x55, 0x87, 0x41, 0x57, 0x8b, 0x29, - 0x62, 0xb0, 0x45, 0xbb, 0xb1, 0xb5, 0x71, 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, 0x5a, 0x90, 0xce, 0xe7, 0x9a, 0x80, 0xdb, 0x9a, 0x80, 0x9f, 0x35, 0x01, 0xbf, 0x6b, - 0x02, 0x66, 0xae, 0xfd, 0xb5, 0x47, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2d, 0x82, 0xe5, 0xdf, - 0x5e, 0x02, 0x00, 0x00, + // 462 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xb1, 0x6e, 0xd3, 0x40, + 0x1c, 0xc6, 0x73, 0x4e, 0xe3, 0xa4, 0x97, 0xb6, 0x98, 0xa3, 0xaa, 0x8c, 0x41, 0x8e, 0xc5, 0x14, + 0x31, 0xd8, 0xa2, 0xdd, 0xd8, 0xda, 0x38, 0x42, 0x11, 0x92, 0x6b, 0x39, 0x8d, 0x18, 0x2b, 0x27, + 0x77, 0x98, 0x53, 0xdb, 0x3b, 0xeb, 0x7c, 0x06, 0xba, 0x31, 0xa2, 0xbe, 0x43, 0xc5, 0x00, 0x4f, + 0xc1, 0x13, 0x74, 0x64, 0x42, 0x4c, 0x15, 0xf1, 0x93, 0xa0, 0x3b, 0x9b, 0xe0, 0x81, 0xc5, 0xfa, + 0x7f, 0xdf, 0xef, 0xf3, 0xe7, 0xff, 0x5f, 0x32, 0x7c, 0x99, 0x51, 0xf9, 0xae, 0x5c, 0xfa, 0x2b, + 0x7e, 0x15, 0xac, 0x38, 0x93, 0x29, 0x65, 0x44, 0xe0, 0xf6, 0x98, 0xe6, 0x34, 0x90, 0xd7, 0x39, + 0x29, 0x02, 0x99, 0x16, 0x17, 0xfa, 0xe1, 0xe7, 0x82, 0x4b, 0x8e, 0x1e, 0xfd, 0x4b, 0xf9, 0xef, + 0x5f, 0xf8, 0x3a, 0xe4, 0xec, 0x67, 0x3c, 0xe3, 0x9a, 0x07, 0x6a, 0xaa, 0xa3, 0xce, 0xe3, 0x8c, + 0xf3,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b, 0xad, 0xc1, 0x82, 0x5d, 0x30, 0xfe, 0x81, 0x29, + 0x3e, 0x49, 0xa6, 0xc7, 0x67, 0xd3, 0xd0, 0x02, 0x6d, 0x3e, 0x11, 0x24, 0x95, 0x04, 0x2b, 0x9e, + 0x2c, 0xa2, 0x68, 0x16, 0xbd, 0xb2, 0x8c, 0x36, 0x4f, 0x4a, 0xc6, 0x28, 0xcb, 0x14, 0x9f, 0x9f, + 0x9d, 0xc6, 0xf1, 0x34, 0xb4, 0xba, 0x6d, 0x3e, 0x97, 0x3c, 0xcf, 0x09, 0x46, 0x4f, 0xa1, 0x19, + 0x1f, 0x2f, 0xe6, 0xd3, 0xd0, 0xda, 0x72, 0xac, 0x9b, 0x5b, 0x6f, 0xa7, 0xc6, 0x71, 0x5a, 0x16, + 0x75, 0xbb, 0xa2, 0xaa, 0xbd, 0xd7, 0x7e, 0x5b, 0x61, 0xca, 0x32, 0x67, 0xef, 0xf3, 0x57, 0xb7, + 0xf3, 0xfd, 0x9b, 0xdb, 0x5c, 0x73, 0x62, 0xdf, 0xad, 0xdd, 0xce, 0xaf, 0xb5, 0xdb, 0xf9, 0x54, + 0xb9, 0xe0, 0xae, 0x72, 0xc1, 0x8f, 0xca, 0x05, 0xbf, 0x2b, 0x17, 0x2c, 0x4d, 0xfd, 0x6f, 0x1c, + 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x22, 0xfa, 0xb5, 0x46, 0x9f, 0x02, 0x00, 0x00, } diff --git a/api/types/task/task.proto b/api/types/task/task.proto index f4c5c9429..930ed7966 100644 --- a/api/types/task/task.proto +++ b/api/types/task/task.proto @@ -14,6 +14,7 @@ enum Status { RUNNING = 2 [(gogoproto.enumvalue_customname) = "StatusRunning"]; STOPPED = 3 [(gogoproto.enumvalue_customname) = "StatusStopped"]; PAUSED = 4 [(gogoproto.enumvalue_customname) = "StatusPaused"]; + PAUSING = 5 [(gogoproto.enumvalue_customname) = "StatusPausing"]; } message Process { @@ -25,4 +26,5 @@ message Process { string stdout = 6; string stderr = 7; bool terminal = 8; + uint32 exit_status = 9; } diff --git a/checkpoint_test.go b/checkpoint_test.go index 8fd1fba16..4beb11862 100644 --- a/checkpoint_test.go +++ b/checkpoint_test.go @@ -264,7 +264,7 @@ func TestCheckpointLeaveRunning(t *testing.T) { t.Error(err) return } - if status != Running { + if status.Status != Running { t.Errorf("expected status %q but received %q", Running, status) return } diff --git a/cmd/ctr/delete.go b/cmd/ctr/delete.go index 3584ec773..39b25cdc7 100644 --- a/cmd/ctr/delete.go +++ b/cmd/ctr/delete.go @@ -59,7 +59,7 @@ func deleteContainer(ctx context.Context, client *containerd.Client, id string, if err != nil { return err } - if status == containerd.Stopped || status == containerd.Created { + if status.Status == containerd.Stopped || status.Status == containerd.Created { if _, err := task.Delete(ctx); err != nil { return err } diff --git a/container_test.go b/container_test.go index 5d0dda4d7..3cde907c5 100644 --- a/container_test.go +++ b/container_test.go @@ -1028,13 +1028,13 @@ func TestWaitStoppedTask(t *testing.T) { } // wait for the task to stop then call wait again <-statusC - _, err = task.Wait(ctx) - if err == nil { - t.Error("Wait after task exits should return an error") + status, err := task.Wait(ctx) + if err != nil { + t.Error(err) return } - if !errdefs.IsUnavailable(err) { - t.Errorf("Wait should return %q when task Stopped: %v", errdefs.ErrUnavailable, err) + if status != 7 { + t.Errorf("exit status from stopped task should be 7 but received %d", status) } } @@ -1119,13 +1119,13 @@ func TestWaitStoppedProcess(t *testing.T) { // wait for the exec to return <-processStatusC // try to wait on the process after it has stopped - _, err = process.Wait(ctx) - if err == nil { - t.Error("Wait after process exits should return an error") + status, err := process.Wait(ctx) + if err != nil { + t.Error(err) return } - if !errdefs.IsUnavailable(err) { - t.Errorf("Wait should return %q when process has exited: %v", errdefs.ErrUnavailable, err) + if status != 6 { + t.Errorf("exit status from stopped process should be 6 but received %d", status) } if err := task.Kill(ctx, syscall.SIGKILL); err != nil { t.Error(err) diff --git a/linux/process.go b/linux/process.go index 337bc41bb..663ea7e5a 100644 --- a/linux/process.go +++ b/linux/process.go @@ -49,15 +49,17 @@ func (p *Process) State(ctx context.Context) (runtime.State, error) { status = runtime.StoppedStatus case task.StatusPaused: status = runtime.PausedStatus - // TODO: containerd.DeletedStatus + case task.StatusPausing: + status = runtime.PausingStatus } return runtime.State{ - Pid: response.Pid, - Status: status, - Stdin: response.Stdin, - Stdout: response.Stdout, - Stderr: response.Stderr, - Terminal: response.Terminal, + Pid: response.Pid, + Status: status, + Stdin: response.Stdin, + Stdout: response.Stdout, + Stderr: response.Stderr, + Terminal: response.Terminal, + ExitStatus: response.ExitStatus, }, nil } diff --git a/linux/shim/service.go b/linux/shim/service.go index 5957351c4..17d228e51 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -247,17 +247,20 @@ func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi. status = task.StatusStopped case "paused": status = task.StatusPaused + case "pausing": + status = task.StatusPausing } sio := p.Stdio() return &shimapi.StateResponse{ - ID: p.ID(), - Bundle: s.bundle, - Pid: uint32(p.Pid()), - Status: status, - Stdin: sio.stdin, - Stdout: sio.stdout, - Stderr: sio.stderr, - Terminal: sio.terminal, + ID: p.ID(), + Bundle: s.bundle, + Pid: uint32(p.Pid()), + Status: status, + Stdin: sio.stdin, + Stdout: sio.stdout, + Stderr: sio.stderr, + Terminal: sio.terminal, + ExitStatus: uint32(p.ExitStatus()), }, nil } diff --git a/linux/shim/v1/shim.pb.go b/linux/shim/v1/shim.pb.go index 0f370f67d..03c475e74 100644 --- a/linux/shim/v1/shim.pb.go +++ b/linux/shim/v1/shim.pb.go @@ -149,14 +149,15 @@ func (*StateRequest) ProtoMessage() {} func (*StateRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{7} } type StateResponse struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` - Status containerd_v1_types.Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` - Stdin string `protobuf:"bytes,5,opt,name=stdin,proto3" json:"stdin,omitempty"` - Stdout string `protobuf:"bytes,6,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr string `protobuf:"bytes,7,opt,name=stderr,proto3" json:"stderr,omitempty"` - Terminal bool `protobuf:"varint,8,opt,name=terminal,proto3" json:"terminal,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` + Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + Status containerd_v1_types.Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` + Stdin string `protobuf:"bytes,5,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,6,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,7,opt,name=stderr,proto3" json:"stderr,omitempty"` + Terminal bool `protobuf:"varint,8,opt,name=terminal,proto3" json:"terminal,omitempty"` + ExitStatus uint32 `protobuf:"varint,9,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` } func (m *StateResponse) Reset() { *m = StateResponse{} } @@ -1183,6 +1184,11 @@ func (m *StateResponse) MarshalTo(dAtA []byte) (int, error) { } i++ } + if m.ExitStatus != 0 { + dAtA[i] = 0x48 + i++ + i = encodeVarintShim(dAtA, i, uint64(m.ExitStatus)) + } return i, nil } @@ -1660,6 +1666,9 @@ func (m *StateResponse) Size() (n int) { if m.Terminal { n += 2 } + if m.ExitStatus != 0 { + n += 1 + sovShim(uint64(m.ExitStatus)) + } return n } @@ -1895,6 +1904,7 @@ func (this *StateResponse) String() string { `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `}`, }, "") return s @@ -3331,6 +3341,25 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error { } } m.Terminal = bool(v != 0) + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShim + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipShim(dAtA[iNdEx:]) @@ -4311,72 +4340,73 @@ func init() { } var fileDescriptorShim = []byte{ - // 1072 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x5f, 0x6f, 0xe3, 0x44, - 0x10, 0xaf, 0xf3, 0xbf, 0x13, 0x52, 0xda, 0xa5, 0x57, 0x7c, 0x39, 0x29, 0x8d, 0xfc, 0x50, 0x05, - 0xa1, 0x73, 0x68, 0x8a, 0xee, 0x38, 0x90, 0x90, 0xda, 0xde, 0x09, 0x55, 0x50, 0x5d, 0xe5, 0xf6, - 0x00, 0x81, 0x50, 0xe5, 0xc6, 0xdb, 0x64, 0xd5, 0xc4, 0xeb, 0xf3, 0xae, 0x4b, 0xcb, 0x13, 0x4f, - 0x3c, 0xf3, 0x71, 0xf8, 0x08, 0x7d, 0xe4, 0x91, 0xa7, 0x83, 0x8b, 0x84, 0xc4, 0x0b, 0xdf, 0x01, - 0xed, 0x9f, 0x24, 0x4e, 0x52, 0xcb, 0x0e, 0x2f, 0xcd, 0xce, 0xee, 0x6f, 0x66, 0x67, 0xe6, 0x37, - 0x3b, 0xe3, 0xc2, 0xb3, 0x1e, 0xe1, 0xfd, 0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0xca, 0x2f, 0x99, - 0x59, 0x68, 0xe6, 0x5b, 0xd5, 0xce, 0xfb, 0x76, 0x2c, 0xeb, 0xd2, 0x25, 0xfb, 0x58, 0x84, 0xe2, - 0x68, 0x18, 0xaa, 0x43, 0x85, 0xe3, 0x70, 0x48, 0x7c, 0x77, 0x60, 0x16, 0x9b, 0x46, 0xab, 0xe2, - 0x4c, 0x64, 0xb4, 0x09, 0x45, 0xc6, 0x3d, 0xe2, 0x9b, 0x25, 0x79, 0x89, 0x12, 0x84, 0x53, 0x8c, - 0x7b, 0x34, 0xe2, 0x66, 0x59, 0x39, 0xa5, 0x24, 0xbd, 0x8f, 0xc3, 0xd0, 0xac, 0x4c, 0xf6, 0x71, - 0x18, 0xa2, 0x06, 0x40, 0xb7, 0x8f, 0xbb, 0x57, 0x01, 0x25, 0x3e, 0x37, 0x57, 0xe5, 0x59, 0x6c, - 0x07, 0x7d, 0x08, 0x1b, 0x81, 0x1b, 0x62, 0x9f, 0x9f, 0xc7, 0x60, 0x20, 0x61, 0xeb, 0xea, 0xe0, - 0x70, 0x0a, 0xb6, 0xa1, 0x4c, 0x03, 0x4e, 0xa8, 0xcf, 0xcc, 0x6a, 0xd3, 0x68, 0x55, 0x3b, 0x9b, - 0xb6, 0xa2, 0xd9, 0x1e, 0xd3, 0x6c, 0xef, 0xfb, 0xb7, 0xce, 0x18, 0x64, 0xed, 0x00, 0x8a, 0xa7, - 0x9b, 0x05, 0xd4, 0x67, 0x18, 0xad, 0x43, 0x3e, 0xd0, 0x09, 0xaf, 0x39, 0x62, 0x69, 0xfd, 0x62, - 0xc0, 0xda, 0x73, 0x3c, 0xc0, 0x1c, 0x27, 0x83, 0xd0, 0x36, 0x54, 0xf1, 0x0d, 0xe1, 0xe7, 0x8c, - 0xbb, 0x3c, 0x62, 0x92, 0x93, 0x9a, 0x03, 0x62, 0xeb, 0x54, 0xee, 0xa0, 0x7d, 0x58, 0x15, 0x12, - 0xf6, 0xce, 0x5d, 0x2e, 0x99,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0xc1, 0x20, 0x43, 0x23, 0x62, 0xa4, 0x37, - 0x2e, 0x9a, 0x9a, 0xa3, 0x25, 0x11, 0xa7, 0x3b, 0x18, 0xc8, 0x38, 0x2b, 0x8e, 0x58, 0x5a, 0x9f, - 0xc3, 0xda, 0xe1, 0x80, 0x32, 0x7c, 0xf4, 0x32, 0x03, 0x77, 0x2a, 0x38, 0x55, 0x87, 0x4a, 0xb0, - 0x3e, 0x80, 0x77, 0xbf, 0x22, 0x8c, 0x9f, 0x10, 0x2f, 0xb5, 0xf4, 0x77, 0x60, 0x7d, 0x0a, 0xd5, - 0x44, 0x21, 0x28, 0x04, 0xc4, 0x63, 0xa6, 0xd1, 0xcc, 0xb7, 0x6a, 0x8e, 0x5c, 0x5b, 0xdf, 0xc3, - 0x83, 0x69, 0x07, 0x89, 0xb7, 0x5d, 0x01, 0x76, 0x79, 0x5f, 0x99, 0x76, 0xe4, 0x3a, 0xde, 0x60, - 0x72, 0x59, 0x1a, 0xcc, 0x63, 0x58, 0x3f, 0xed, 0x93, 0xe1, 0x91, 0x7f, 0x49, 0x27, 0x4e, 0x3c, - 0x84, 0x8a, 0x18, 0x69, 0xe7, 0xd3, 0xf6, 0x51, 0x16, 0xf2, 0x09, 0xf1, 0xac, 0x2f, 0x60, 0xe3, - 0x55, 0xe0, 0xcd, 0xb5, 0xff, 0x0e, 0xac, 0x86, 0x98, 0xd1, 0x28, 0xec, 0x62, 0x26, 0x15, 0x92, - 0x6e, 0x9d, 0xc2, 0x74, 0x2d, 0x87, 0x3c, 0x2d, 0x49, 0xcf, 0x64, 0x29, 0x0b, 0x5c, 0x4a, 0x29, - 0xeb, 0x92, 0xcd, 0x4d, 0x4a, 0xb6, 0xf3, 0x37, 0x40, 0x41, 0xc4, 0x86, 0xfa, 0x50, 0x94, 0xcf, - 0x01, 0xd9, 0x76, 0xda, 0x0c, 0xb7, 0xe3, 0x0f, 0xac, 0xde, 0xce, 0x8c, 0xd7, 0xce, 0x31, 0x28, - 0xa9,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 0x4f, 0x72, 0xf7, 0xe0, 0xf8, 0xee, 0x6d, - 0x63, 0xe5, 0x8f, 0xb7, 0x8d, 0x95, 0x9f, 0x47, 0x0d, 0xe3, 0x6e, 0xd4, 0x30, 0x7e, 0x1f, 0x35, - 0x8c, 0xbf, 0x46, 0x0d, 0xe3, 0xbb, 0xbd, 0xe5, 0xfe, 0xdb, 0xfa, 0x4c, 0xfc, 0x5e, 0x94, 0xa4, - 0xf9, 0xbd, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x05, 0x95, 0x8a, 0x43, 0xab, 0x0d, 0x00, 0x00, + // 1078 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0xaf, 0xf3, 0x3f, 0x2f, 0xa4, 0xb4, 0x43, 0xb7, 0x78, 0xb3, 0x52, 0x1a, 0xf9, 0x50, 0x05, + 0xa1, 0x75, 0x68, 0x8a, 0x76, 0x59, 0x90, 0x90, 0xda, 0xee, 0x0a, 0x55, 0x50, 0x6d, 0xe5, 0x76, + 0x01, 0x81, 0x50, 0xe5, 0xc6, 0xd3, 0x64, 0xd4, 0xc4, 0xe3, 0xf5, 0x8c, 0x4b, 0xcb, 0x89, 0x13, + 0x12, 0x37, 0x3e, 0x0e, 0x1f, 0xa1, 0x47, 0x8e, 0x9c, 0x16, 0xb6, 0x12, 0x47, 0xbe, 0x03, 0x9a, + 0x3f, 0x49, 0x9c, 0xa4, 0x96, 0x1d, 0x2e, 0xcd, 0xbc, 0x99, 0xdf, 0x9b, 0x79, 0xf3, 0x7e, 0xbf, + 0x79, 0xcf, 0x85, 0x67, 0x7d, 0xc2, 0x07, 0xd1, 0xb9, 0xdd, 0xa3, 0xa3, 0x4e, 0x8f, 0xfa, 0xdc, + 0x25, 0x3e, 0x0e, 0xbd, 0xf8, 0x70, 0x48, 0xfc, 0xe8, 0xba,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cf, 0x77, 0x4d, 0xe3, + 0xf6, 0xae, 0x69, 0xfc, 0x71, 0xd7, 0x34, 0xfe, 0xbe, 0x6b, 0x1a, 0xdf, 0xed, 0x2e, 0xf7, 0xef, + 0xd8, 0x67, 0xe2, 0xf7, 0xbc, 0x24, 0xb7, 0xdf, 0xfd, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x53, 0xf2, + 0x71, 0x3d, 0xcc, 0x0d, 0x00, 0x00, } diff --git a/linux/shim/v1/shim.proto b/linux/shim/v1/shim.proto index d475af587..306b99abc 100644 --- a/linux/shim/v1/shim.proto +++ b/linux/shim/v1/shim.proto @@ -108,6 +108,7 @@ message StateResponse { string stdout = 6; string stderr = 7; bool terminal = 8; + uint32 exit_status = 9; } message KillRequest { diff --git a/linux/task.go b/linux/task.go index 306d6a0ed..91d24acdc 100644 --- a/linux/task.go +++ b/linux/task.go @@ -66,14 +66,17 @@ func (t *Task) State(ctx context.Context) (runtime.State, error) { status = runtime.StoppedStatus case task.StatusPaused: status = runtime.PausedStatus + case task.StatusPausing: + status = runtime.PausingStatus } return runtime.State{ - Pid: response.Pid, - Status: status, - Stdin: response.Stdin, - Stdout: response.Stdout, - Stderr: response.Stderr, - Terminal: response.Terminal, + Pid: response.Pid, + Status: status, + Stdin: response.Stdin, + Stdout: response.Stdout, + Stderr: response.Stderr, + Terminal: response.Terminal, + ExitStatus: response.ExitStatus, }, nil } diff --git a/process.go b/process.go index f85d6ad45..4135e0d17 100644 --- a/process.go +++ b/process.go @@ -76,8 +76,12 @@ func (p *process) Wait(ctx context.Context) (uint32, error) { return UnknownExitStatus, err } // first check if the task has exited - if status, _ := p.Status(ctx); status == Stopped { - return UnknownExitStatus, errdefs.ErrUnavailable + status, err := p.Status(ctx) + if err != nil { + return UnknownExitStatus, errdefs.FromGRPC(err) + } + if status.Status == Stopped { + return status.ExitStatus, nil } for { evt, err := eventstream.Recv() @@ -146,7 +150,10 @@ func (p *process) Status(ctx context.Context) (Status, error) { ExecID: p.id, }) if err != nil { - return "", errdefs.FromGRPC(err) + return Status{}, errdefs.FromGRPC(err) } - return Status(strings.ToLower(r.Process.Status.String())), nil + return Status{ + Status: ProcessStatus(strings.ToLower(r.Process.Status.String())), + ExitStatus: r.Process.ExitStatus, + }, nil } diff --git a/runtime/task.go b/runtime/task.go index 612d54523..4a5685e10 100644 --- a/runtime/task.go +++ b/runtime/task.go @@ -68,15 +68,19 @@ const ( StoppedStatus DeletedStatus PausedStatus + PausingStatus ) type State struct { // Status is the current status of the container Status Status // Pid is the main process id for the container - Pid uint32 - Stdin string - Stdout string - Stderr string - Terminal bool + Pid uint32 + // ExitStatus of the process + // Only vaid if the Status is Stopped + ExitStatus uint32 + Stdin string + Stdout string + Stderr string + Terminal bool } diff --git a/services/tasks/service.go b/services/tasks/service.go index 46c6d4380..0d0129398 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -227,17 +227,20 @@ func processFromContainerd(ctx context.Context, p runtime.Process) (*task.Proces status = task.StatusStopped case runtime.PausedStatus: status = task.StatusPaused + case runtime.PausingStatus: + status = task.StatusPausing default: log.G(ctx).WithField("status", state.Status).Warn("unknown status") } return &task.Process{ - ID: p.ID(), - Pid: state.Pid, - Status: status, - Stdin: state.Stdin, - Stdout: state.Stdout, - Stderr: state.Stderr, - Terminal: state.Terminal, + ID: p.ID(), + Pid: state.Pid, + Status: status, + Stdin: state.Stdin, + Stdout: state.Stdout, + Stderr: state.Stderr, + Terminal: state.Terminal, + ExitStatus: state.ExitStatus, }, nil } diff --git a/task.go b/task.go index 111339fd7..d586fb9ff 100644 --- a/task.go +++ b/task.go @@ -28,14 +28,19 @@ import ( const UnknownExitStatus = 255 -type Status string +type Status struct { + Status ProcessStatus + ExitStatus uint32 +} + +type ProcessStatus string const ( - Running Status = "running" - Created Status = "created" - Stopped Status = "stopped" - Paused Status = "paused" - Pausing Status = "pausing" + Running ProcessStatus = "running" + Created ProcessStatus = "created" + Stopped ProcessStatus = "stopped" + Paused ProcessStatus = "paused" + Pausing ProcessStatus = "pausing" ) type IOCloseInfo struct { @@ -146,12 +151,14 @@ func (t *task) Status(ctx context.Context) (Status, error) { ContainerID: t.id, }) if err != nil { - return "", errdefs.FromGRPC(err) + return Status{}, errdefs.FromGRPC(err) } - return Status(strings.ToLower(r.Process.Status.String())), nil + return Status{ + Status: ProcessStatus(strings.ToLower(r.Process.Status.String())), + ExitStatus: r.Process.ExitStatus, + }, nil } -// Wait is a blocking call that will wait for the task to exit and return the exit status func (t *task) Wait(ctx context.Context) (uint32, error) { eventstream, err := t.client.EventService().Subscribe(ctx, &eventsapi.SubscribeRequest{ Filters: []string{"topic==" + runtime.TaskExitEventTopic}, @@ -160,8 +167,12 @@ func (t *task) Wait(ctx context.Context) (uint32, error) { return UnknownExitStatus, errdefs.FromGRPC(err) } // first check if the task has exited - if status, _ := t.Status(ctx); status == Stopped { - return UnknownExitStatus, errdefs.ErrUnavailable + status, err := t.Status(ctx) + if err != nil { + return UnknownExitStatus, errdefs.FromGRPC(err) + } + if status.Status == Stopped { + return status.ExitStatus, nil } for { evt, err := eventstream.Recv() diff --git a/windows/process.go b/windows/process.go index e3c002527..6aaa9b710 100644 --- a/windows/process.go +++ b/windows/process.go @@ -39,12 +39,13 @@ func (p *process) ID() string { func (p *process) State(ctx context.Context) (runtime.State, error) { return runtime.State{ - Status: p.Status(), - Pid: p.pid, - Stdin: p.io.src.Stdin, - Stdout: p.io.src.Stdout, - Stderr: p.io.src.Stderr, - Terminal: p.io.src.Terminal, + Status: p.Status(), + Pid: p.pid, + Stdin: p.io.src.Stdin, + Stdout: p.io.src.Stdout, + Stderr: p.io.src.Stderr, + Terminal: p.io.src.Terminal, + ExitStatus: p.exitCode, }, nil } diff --git a/windows/task.go b/windows/task.go index 402847faa..f8caa67cd 100644 --- a/windows/task.go +++ b/windows/task.go @@ -44,21 +44,26 @@ func (t *task) ID() string { } func (t *task) State(ctx context.Context) (runtime.State, error) { - var status runtime.Status + var ( + status runtime.Status + exitStatus uint32 + ) if p := t.getProcess(t.id); p != nil { status = p.Status() + exitStatus = p.exitCode } else { status = t.getStatus() } return runtime.State{ - Status: status, - Pid: t.pid, - Stdin: t.io.src.Stdin, - Stdout: t.io.src.Stdout, - Stderr: t.io.src.Stderr, - Terminal: t.io.src.Terminal, + Status: status, + Pid: t.pid, + Stdin: t.io.src.Stdin, + Stdout: t.io.src.Stdout, + Stderr: t.io.src.Stderr, + Terminal: t.io.src.Terminal, + ExitStatus: exitStatus, }, nil }