From d16a2c9467d5a2e538c59b4d1f0a5b2d75d06541 Mon Sep 17 00:00:00 2001 From: stswidwinski Date: Thu, 17 Nov 2022 10:47:11 -0500 Subject: [PATCH] Fix goroutine leakage (#15180) * Fix goroutine leakage * cl: add cl entry Co-authored-by: Seth Hoenig --- .changelog/15180.txt | 3 +++ plugins/drivers/client.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changelog/15180.txt diff --git a/.changelog/15180.txt b/.changelog/15180.txt new file mode 100644 index 000000000..342a238c7 --- /dev/null +++ b/.changelog/15180.txt @@ -0,0 +1,3 @@ +```release-note:bug +drivers: Fixed a bug where one goroutine was leaked per task +``` diff --git a/plugins/drivers/client.go b/plugins/drivers/client.go index 592d47b74..68389a960 100644 --- a/plugins/drivers/client.go +++ b/plugins/drivers/client.go @@ -187,7 +187,8 @@ func (d *driverPluginClient) handleWaitTask(ctx context.Context, id string, ch c } // Join the passed context and the shutdown context - joinedCtx, _ := joincontext.Join(ctx, d.doneCtx) + joinedCtx, joinedCtxCancel := joincontext.Join(ctx, d.doneCtx) + defer joinedCtxCancel() resp, err := d.client.WaitTask(joinedCtx, req) if err != nil {