moby / buildkit

concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
https://github.com/moby/moby/issues/34227
Apache License 2.0
8.09k stars 1.14k forks source link

executor: fix cancellation before start signal #5106

Closed tonistiigi closed 3 months ago

tonistiigi commented 3 months ago

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 in 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.