From 79bf79882c5a473e4e6e3e0c977415bafe8835bb Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Fri, 22 Aug 2025 20:31:44 +0530 Subject: [PATCH 1/4] bugfix --- .chloggen/batcher-bug-workers.yaml | 25 +++++++++++++++++++ .../internal/queuebatch/partition_batcher.go | 6 +++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .chloggen/batcher-bug-workers.yaml diff --git a/.chloggen/batcher-bug-workers.yaml b/.chloggen/batcher-bug-workers.yaml new file mode 100644 index 000000000000..affafc533ca2 --- /dev/null +++ b/.chloggen/batcher-bug-workers.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: exporterhelper + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Prevent uncontrolled goroutines in batcher due to a incorrect worker pool behaviour. + +# One or more tracking issues or pull requests related to the change +issues: [] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/exporter/exporterhelper/internal/queuebatch/partition_batcher.go b/exporter/exporterhelper/internal/queuebatch/partition_batcher.go index bedf07bf2211..6ec66b10aed4 100644 --- a/exporter/exporterhelper/internal/queuebatch/partition_batcher.go +++ b/exporter/exporterhelper/internal/queuebatch/partition_batcher.go @@ -261,8 +261,10 @@ func newWorkerPool(maxWorkers int) *workerPool { func (wp *workerPool) execute(f func()) { <-wp.workers - go f() - wp.workers <- struct{}{} + go func() { + f() + wp.workers <- struct{}{} + }() } type multiDone []queue.Done From d747a17630657b9a4499bf48e7c2a63e41ed13b4 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Fri, 22 Aug 2025 20:43:32 +0530 Subject: [PATCH 2/4] changelog --- .chloggen/batcher-bug-workers.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/batcher-bug-workers.yaml b/.chloggen/batcher-bug-workers.yaml index affafc533ca2..5b1d52d9f47a 100644 --- a/.chloggen/batcher-bug-workers.yaml +++ b/.chloggen/batcher-bug-workers.yaml @@ -10,7 +10,7 @@ component: exporterhelper note: Prevent uncontrolled goroutines in batcher due to a incorrect worker pool behaviour. # One or more tracking issues or pull requests related to the change -issues: [] +issues: [13689] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document. From 604bb42d3e4fc5fefa77aa5b0384e43756bfd82c Mon Sep 17 00:00:00 2001 From: Vihas Makwana <121151420+VihasMakwana@users.noreply.github.com> Date: Fri, 22 Aug 2025 21:59:22 +0530 Subject: [PATCH 3/4] Update exporter/exporterhelper/internal/queuebatch/partition_batcher.go Co-authored-by: Bogdan Drutu --- .../exporterhelper/internal/queuebatch/partition_batcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporter/exporterhelper/internal/queuebatch/partition_batcher.go b/exporter/exporterhelper/internal/queuebatch/partition_batcher.go index 6ec66b10aed4..c5c7d7146a92 100644 --- a/exporter/exporterhelper/internal/queuebatch/partition_batcher.go +++ b/exporter/exporterhelper/internal/queuebatch/partition_batcher.go @@ -262,8 +262,8 @@ func newWorkerPool(maxWorkers int) *workerPool { func (wp *workerPool) execute(f func()) { <-wp.workers go func() { + defer wp.workers <- struct{}{} f() - wp.workers <- struct{}{} }() } From 926901d2a61406c3b0f20f5d05f518ccba6423bc Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Fri, 22 Aug 2025 22:09:20 +0530 Subject: [PATCH 4/4] syntax --- .../exporterhelper/internal/queuebatch/partition_batcher.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exporter/exporterhelper/internal/queuebatch/partition_batcher.go b/exporter/exporterhelper/internal/queuebatch/partition_batcher.go index c5c7d7146a92..7ee88e8b6fd8 100644 --- a/exporter/exporterhelper/internal/queuebatch/partition_batcher.go +++ b/exporter/exporterhelper/internal/queuebatch/partition_batcher.go @@ -262,7 +262,9 @@ func newWorkerPool(maxWorkers int) *workerPool { func (wp *workerPool) execute(f func()) { <-wp.workers go func() { - defer wp.workers <- struct{}{} + defer func() { + wp.workers <- struct{}{} + }() f() }() }