Merge pull request #138 from tonistiigi/allow-pidfile-error2
Retry on pidfile read error
This commit is contained in:
commit
7146b01a3d
3 changed files with 3 additions and 2 deletions
|
@ -313,7 +313,7 @@ func (c *container) writeEventFD(root string, cfd, efd int) error {
|
||||||
func waitForStart(p *process, cmd *exec.Cmd) error {
|
func waitForStart(p *process, cmd *exec.Cmd) error {
|
||||||
for i := 0; i < 300; i++ {
|
for i := 0; i < 300; i++ {
|
||||||
if _, err := p.getPidFromFile(); err != nil {
|
if _, err := p.getPidFromFile(); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) || err == errInvalidPidInt {
|
||||||
alive, err := isAlive(cmd)
|
alive, err := isAlive(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -199,7 +199,7 @@ func (p *process) getPidFromFile() (int, error) {
|
||||||
}
|
}
|
||||||
i, err := strconv.Atoi(string(data))
|
i, err := strconv.Atoi(string(data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, err
|
return -1, errInvalidPidInt
|
||||||
}
|
}
|
||||||
p.pid = i
|
p.pid = i
|
||||||
return i, nil
|
return i, nil
|
||||||
|
|
|
@ -19,6 +19,7 @@ var (
|
||||||
ErrContainerNotStarted = errors.New("containerd: container not started")
|
ErrContainerNotStarted = errors.New("containerd: container not started")
|
||||||
|
|
||||||
errNoPidFile = errors.New("containerd: no process pid file found")
|
errNoPidFile = errors.New("containerd: no process pid file found")
|
||||||
|
errInvalidPidInt = errors.New("containerd: process pid is invalid")
|
||||||
errNotImplemented = errors.New("containerd: not implemented")
|
errNotImplemented = errors.New("containerd: not implemented")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue