mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
[1.0] retry unix.EINTR for container init process
When running a script from an azure file share interrupted syscall occurs quite frequently, to remedy this add retries around execve syscall, when EINTR is returned. Signed-off-by: Maksim An <maksiman@microsoft.com> (cherry picked from commite39ad65059) [Minor conflict in libcontainer/standard_init_linux.go due to missing commite918d02139-- resolved manually] Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -224,7 +224,7 @@ func (l *linuxStandardInit) Init() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unix.Exec(name, l.config.Args[0:], os.Environ()); err != nil {
|
||||
if err := system.Exec(name, l.config.Args[0:], os.Environ()); err != nil {
|
||||
return newSystemErrorWithCause(err, "exec user process")
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -35,7 +35,16 @@ func Execv(cmd string, args []string, env []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return unix.Exec(name, args, env)
|
||||
return Exec(name, args, env)
|
||||
}
|
||||
|
||||
func Exec(cmd string, args []string, env []string) error {
|
||||
for {
|
||||
err := unix.Exec(cmd, args, env)
|
||||
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Prlimit(pid, resource int, limit unix.Rlimit) error {
|
||||
|
||||
Reference in New Issue
Block a user