mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-18 21:34:40 +08:00
Show proper error from init process panic
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime/debug"
|
||||||
"strconv"
|
"strconv"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
@@ -248,6 +249,13 @@ func (l *LinuxFactory) StartInitialization() (err error) {
|
|||||||
// ensure that this pipe is always closed
|
// ensure that this pipe is always closed
|
||||||
pipe.Close()
|
pipe.Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
err = fmt.Errorf("panic from initialization: %v, %v", e, string(debug.Stack()))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
i, err = newContainerInit(it, pipe)
|
i, err = newContainerInit(it, pipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@@ -340,7 +340,7 @@ loop:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !sentRun {
|
if !sentRun {
|
||||||
return newSystemError(fmt.Errorf("could not synchronise with container process"))
|
return newSystemError(fmt.Errorf("could not synchronise with container process: %v", ierr))
|
||||||
}
|
}
|
||||||
if p.config.Config.Namespaces.Contains(configs.NEWNS) && !sentResume {
|
if p.config.Config.Namespaces.Contains(configs.NEWNS) && !sentResume {
|
||||||
return newSystemError(fmt.Errorf("could not synchronise after executing prestart hooks with container process"))
|
return newSystemError(fmt.Errorf("could not synchronise after executing prestart hooks with container process"))
|
||||||
|
Reference in New Issue
Block a user