Skip to content

Commit 7089987

Browse files
committed
executor: fix cancellation before start signal
If context is canceled before the process is ready then kill goroutine returns early because there is nothing to kill. But the process may still start after this and that case remain running without cancellation. Fix is to skip cancellation only if the run goroutine is ended, as then the process will not be started. Signed-off-by: Tonis Tiigi <[email protected]>
1 parent 2ec1338 commit 7089987

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

executor/runcexecutor/executor.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,14 @@ func runcProcessHandle(ctx context.Context, killer procKiller) (*procHandle, con
610610
go func() {
611611
// Wait for pid
612612
select {
613-
case <-ctx.Done():
613+
case <-p.ended:
614614
return // nothing to kill
615615
case <-p.ready:
616+
select {
617+
case <-p.ended:
618+
return
619+
default:
620+
}
616621
}
617622

618623
for {

0 commit comments

Comments
 (0)