[BUG] goroutine leak of datastreams.Processor
from mocktracer
#2858
Labels
bug
unintended behavior that has to be fixed
datastreams.Processor
from mocktracer
#2858
Version of dd-trace-go
Visible on
v1.66.0
although from a read through of code onmain
the issue is still present.Describe what happened:
mocktracer
+ https://github.com/uber-go/goleakdefer goleak.VerifyNone(t)
+defer tracer.Stop()
A read through the code shows that
(*Processor).reportStats
is always going to leak: https://github.com/DataDog/dd-trace-go/blob/main/internal/datastreams/processor.go#L374, as there's no mechanism to clean it up.But
(*Processor).run
won't leak if the(*Processor).Stop
is called: https://github.com/DataDog/dd-trace-go/blob/main/internal/datastreams/processor.go#L366-L372, https://github.com/DataDog/dd-trace-go/blob/main/internal/datastreams/processor.go#L320.Describe what you expected:
The call to
mocktracer.Stop()
explicitly shuts down theProcessor
it started, and blocks to wait for all spawned goroutines to exit.Steps to reproduce the issue:
Additional environment details (Version of Go, Operating System, etc.):
OS:
macOS 14.5 (23F79) (Sinoma + M1)
GO:
go version go1.23.1 darwin/arm64
The text was updated successfully, but these errors were encountered: