Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] pkg/trace/metrics/timing is leaking a goroutine #22030

Closed
crobert-1 opened this issue Jan 12, 2024 · 0 comments · Fixed by #22183
Closed

[BUG] pkg/trace/metrics/timing is leaking a goroutine #22030

crobert-1 opened this issue Jan 12, 2024 · 0 comments · Fixed by #22183
Labels
team/agent-apm trace-agent

Comments

@crobert-1
Copy link

Agent Environment

N/A

Describe what happened:
While working on open-telemetry/opentelemetry-collector-contrib#30438, goleak detected a leaking goroutine. This is happening due to an indirect dependency on the timing package.

Here's the output of goleak:

 Goroutine 70 in state select, with github.com/DataDog/datadog-agent/pkg/trace/metrics/timing.(*Set).Autoreport.func1 on top of the stack:
github.com/DataDog/datadog-agent/pkg/trace/metrics/timing.(*Set).Autoreport.func1()
        /Users/crobert/go/pkg/mod/github.com/!data!dog/datadog-agent/pkg/trace@v0.50.2/metrics/timing/timing.go:59 +0xed
created by github.com/DataDog/datadog-agent/pkg/trace/metrics/timing.(*Set).Autoreport in goroutine 1
        /Users/crobert/go/pkg/mod/github.com/!data!dog/datadog-agent/pkg/trace@v0.50.2/metrics/timing/timing.go:54 +0x96

Describe what you expected:
No leaking goroutines. The impact here is leaked memory usage upon shutdown. Since this is happens when timing is an indirect dependency there's no access to timing.Stop().

Steps to reproduce the issue:
import "github.com/DataDog/datadog-agent/pkg/trace/agent"

Additional environment details (Operating System, Cloud provider, etc):
Related to #13934
Here's a more in-depth explanation around an identical issue that is in OpenCensus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team/agent-apm trace-agent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants