Skip to content

Commit 665815b

Browse files
fuweidRandom-Liu
authored andcommitted
enhance: update v1/v2 runtime
1. avoid dead lock during kill, fetch allProcesses before handle events 2. use argu's ctx instead of context.Backgroud() in openlog Signed-off-by: Wei Fu <[email protected]>
1 parent b337430 commit 665815b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

linux/shim/service.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,19 @@ func (s *Service) processExits() {
451451
}
452452
}
453453

454-
func (s *Service) checkProcesses(e runc.Exit) {
454+
func (s *Service) allProcesses() []proc.Process {
455455
s.mu.Lock()
456456
defer s.mu.Unlock()
457+
458+
res := make([]proc.Process, 0, len(s.processes))
457459
for _, p := range s.processes {
460+
res = append(res, p)
461+
}
462+
return res
463+
}
464+
465+
func (s *Service) checkProcesses(e runc.Exit) {
466+
for _, p := range s.allProcesses() {
458467
if p.Pid() == e.Pid {
459468
if ip, ok := p.(*proc.Init); ok {
460469
// Ensure all children are killed

0 commit comments

Comments
 (0)