Skip to content

Commit d235ae9

Browse files
committed
linux/prox: timeout fifo creation
Under certain conditions in the client, the fifo for a container may not be created. A timeout has been added to this operation to ensure the shim can recover when the client fails to open the fifos. Signed-off-by: Stephen J Day <[email protected]> (cherry picked from commit 9754696) Signed-off-by: Stephen J Day <[email protected]>
1 parent a609ec4 commit d235ae9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

linux/proc/exec.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ func (e *execProcess) start(ctx context.Context) (err error) {
147147
return e.parent.runtimeError(err, "OCI runtime exec failed")
148148
}
149149
if e.stdio.Stdin != "" {
150-
sc, err := fifo.OpenFifo(ctx, e.stdio.Stdin, syscall.O_WRONLY|syscall.O_NONBLOCK, 0)
150+
fifoCtx, cancel := context.WithTimeout(ctx, 15*time.Second)
151+
defer cancel()
152+
153+
sc, err := fifo.OpenFifo(fifoCtx, e.stdio.Stdin, syscall.O_WRONLY|syscall.O_NONBLOCK, 0)
151154
if err != nil {
152155
return errors.Wrapf(err, "failed to open stdin fifo %s", e.stdio.Stdin)
153156
}
@@ -164,7 +167,10 @@ func (e *execProcess) start(ctx context.Context) (err error) {
164167
return errors.Wrap(err, "failed to start console copy")
165168
}
166169
} else if !e.stdio.IsNull() {
167-
if err := copyPipes(ctx, e.io, e.stdio.Stdin, e.stdio.Stdout, e.stdio.Stderr, &e.wg, &copyWaitGroup); err != nil {
170+
fifoCtx, cancel := context.WithTimeout(ctx, 15*time.Second)
171+
defer cancel()
172+
173+
if err := copyPipes(fifoCtx, e.io, e.stdio.Stdin, e.stdio.Stdout, e.stdio.Stderr, &e.wg, &copyWaitGroup); err != nil {
168174
return errors.Wrap(err, "failed to start io pipe copy")
169175
}
170176
}

0 commit comments

Comments
 (0)