OpenTelemetry-Go: BatchProcessor can busy-spin when export buffer is full
Published 29 Sept 2026 · Updated 1 Oct 2026
Is your project on an affected go.opentelemetry.io/otel/sdk/log?
Look after several Go apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- <0.21.0
- Fixed in
- 0.21.0
go get go.opentelemetry.io/otel/sdk/log@v0.21.0Details
Summary
A BatchingProcessor in go.opentelemetry.io/otel/sdk/log can enter a tight CPU loop when the asynchronous export buffer is full. Under exporter backpressure, attacker-driven high-volume log emission can keep the queue at or above the batch size, causing repeated immediate export retries and a denial of service through CPU exhaustion.
Introduced in commit: 4af9c20
Details
NewBatchingProcessor wraps the exporter with newBufferExporter(exporter, 1) (sdk/log/batch.go:116-122), so the asynchronous export input can fill quickly when the downstream exporter blocks. The poll goroutine dequeues a batch with b.q.TryDequeue, calls b.exporter.EnqueueExport(r), and then immediately sends on b.pollTrigger whenever qLen >= b.batchSize (sdk/log/batch.go:129-165).
bufferExporter.EnqueueExport is non-blocking: it sends to e.input if possible and returns false in the default case when the channel is full (sdk/log/exporter.go:221-248). TryDequeue leaves q.len unchanged when the write callback returns false (sdk/log/batch.go:289-314). Therefore, while the exporter is backpressured, EnqueueExport fails, the queue remains at or above one full batch, and the poll loop continuously retriggers itself without waiting for the ticker.
PoC
The validation artifact contains a PoC bundle:
validation-artifact.tar:main.go: PoC source.validation-artifact.tar:README.md: build/run notes.validation-artifact.tar:build_failed.log: captured build failure from the validation environment.
The PoC configures a blocking exporter and a BatchingProcessor with WithExportMaxBatchSize(1), WithExportInterval(5*time.Second), and WithMaxQueueSize(2048). It emits 1000 records, records a CPU profile for 750 ms while the exporter is blocked, then writes /workspace/validation_artifacts/busyloop.pprof.
Reproduction steps from an affected checkout at commit 4af9c20:
cd /workspace/opentelemetry-go git checkout 4af9c20 mkdir -p validation_poc/busyloop /workspace/validation_artifacts /tmp/batchingprocessor-busyloop-poc tar -xf /path/to/this/finding/validation-artifact.tar -C /tmp/batchingprocessor-busyloop-poc cp /tmp/batchingprocessor-busyloop-poc/main.go validation_poc/busyloop/main.go go build -o validation_poc/busyloop/busyloop ./validation_poc/busyloop ./validation_poc/busyloop/busyloop go tool pprof -top /workspace/validation_artifacts/busyloop.pprof
Expected program output:
cpu profile written to /workspace/validation_artifacts/busyloop.pprof
Expected profile evidence: hot functions should include (*BatchingProcessor).poll, (*queue).TryDequeue, and (*bufferExporter).EnqueueExport, showing repeated export attempts while the exporter is blocked.
Impact
This is an availability vulnerability: uncontrolled CPU consumption caused by a busy-spin retry loop. Applications using sdk/log BatchingProcessor are impacted when an attacker can cause sustained log emission and the configured exporter or downstream collector is slow, blocked, or otherwise backpressured. The impact is limited to the embedding process but can degrade or deny service for that application.
Is GHSA-hjf4-fphr-2h65 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected go.opentelemetry.io/otel/sdk/log, and gives you the command that fixes it.
More advisories for go.opentelemetry.io/otel/sdk/log
- MediumCVE-2026-128085opentelemetry-go: AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes · 13 Nov 2026
References
- Linkgithub.com/open-telemetry/opentelemetry-go/security/advisories/GHSA-hjf4-fphr-2h65
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-81872
- Linkgithub.com/open-telemetry/opentelemetry-go/issues/6797
- Linkgithub.com/open-telemetry/opentelemetry-go/pull/8620
- Linkgithub.com/open-telemetry/opentelemetry-go/commit/ba71b09e6ed272e93a669aeaec1e98b1df4cc582
- Packagegithub.com/open-telemetry/opentelemetry-go
- Linkgithub.com/open-telemetry/opentelemetry-go/releases/tag/sdk/log/v0.21.0
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.