X Tutup
Skip to content

Commit f9ecd09

Browse files
committed
Retry on pidfile read error
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
1 parent 707555b commit f9ecd09

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

runtime/container_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ func (c *container) writeEventFD(root string, cfd, efd int) error {
313313
func waitForStart(p *process, cmd *exec.Cmd) error {
314314
for i := 0; i < 300; i++ {
315315
if _, err := p.getPidFromFile(); err != nil {
316-
if os.IsNotExist(err) {
316+
if os.IsNotExist(err) || err == errInvalidPidInt {
317317
alive, err := isAlive(cmd)
318318
if err != nil {
319319
return err

runtime/process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func (p *process) getPidFromFile() (int, error) {
199199
}
200200
i, err := strconv.Atoi(string(data))
201201
if err != nil {
202-
return -1, err
202+
return -1, errInvalidPidInt
203203
}
204204
p.pid = i
205205
return i, nil

runtime/runtime.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var (
1919
ErrContainerNotStarted = errors.New("containerd: container not started")
2020

2121
errNoPidFile = errors.New("containerd: no process pid file found")
22+
errInvalidPidInt = errors.New("containerd: process pid is invalid")
2223
errNotImplemented = errors.New("containerd: not implemented")
2324
)
2425

0 commit comments

Comments
 (0)
X Tutup