mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-11-04 11:50:15 +00:00 
			
		
		
		
	runtime: reap force killed processes
reap child processes after sending SIGKILL Fixes #5739 Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
This commit is contained in:
		@@ -375,8 +375,19 @@ outer:
 | 
				
			|||||||
	if pidRunning {
 | 
						if pidRunning {
 | 
				
			||||||
		// Force process to die
 | 
							// Force process to die
 | 
				
			||||||
		if err = syscall.Kill(pid, syscall.SIGKILL); err != nil {
 | 
							if err = syscall.Kill(pid, syscall.SIGKILL); err != nil {
 | 
				
			||||||
 | 
								if err == syscall.ESRCH {
 | 
				
			||||||
 | 
									logger.WithField("pid", pid).Warnf("process already finished")
 | 
				
			||||||
 | 
									return nil
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			return fmt.Errorf("Failed to stop process %v: %s", pid, err)
 | 
								return fmt.Errorf("Failed to stop process %v: %s", pid, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for {
 | 
				
			||||||
 | 
								_, err := syscall.Wait4(pid, nil, 0, nil)
 | 
				
			||||||
 | 
								if err != syscall.EINTR {
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user