fix(solver): check for context canceled in ReleaseUnreferenced

The existing implementations do not check for the context being canceled
when `ReleaseUnreferenced` is called which has caused a bug in how the
controller invokes `ReleaseUnreferenced` to be uncaught. We pass an
already canceled context to the method which causes any implementations
that do check the context to always fail.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
Jonathan A. Sternberg committed 2026-10-09 13:18:03 -05:00
1 parent d51c989432
commit b853c78c35
1 file changed
+3 -2
+3 -2
View File
@@ -245,7 +245,8 @@ func (c *Controller) Prune(req *controlapi.PruneRequest, stream controlapi.Contr
ch := make(chan client.UsageInfo, 32)
eg, ctx := errgroup.WithContext(stream.Context())
ctx := stream.Context()
eg, ectx := errgroup.WithContext(ctx)
workers, err := c.opt.WorkerController.List()
if err != nil {
return errors.Wrap(err, "failed to list workers for prune")
@@ -267,7 +268,7 @@ func (c *Controller) Prune(req *controlapi.PruneRequest, stream controlapi.Contr
for _, w := range workers {
func(w worker.Worker) {
eg.Go(func() error {
return w.Prune(ctx, ch, client.PruneInfo{
return w.Prune(ectx, ch, client.PruneInfo{
Filter: req.Filter,
All: req.All,
KeepDuration: time.Duration(req.KeepDuration),