Skip to content

Commit 21e89eb

Browse files
authored
Merge pull request #2232 from stevvooe/cherry-pick-#2229
[release/1.0] linux/prox: timeout fifo creation
2 parents a609ec4 + d235ae9 commit 21e89eb

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)