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

internal/datastreams: fix Processor goroutine leaks #2880

Merged
merged 5 commits into from
Sep 26, 2024
Merged

internal/datastreams: fix Processor goroutine leaks #2880

merged 5 commits into from
Sep 26, 2024

Conversation

ggambetti
Copy link
Contributor

@ggambetti ggambetti commented Sep 18, 2024

What does this PR do?

Fixes goroutine leaks when internal/datastreams.(*Processor).Stop() is called. Previously, the internal/datastreams.(*Processor).runStats goroutine would be left running after the Processor was requested to stop.

This ensures that ddtrace/mocktracer doesn't leak routines with an update to every test that starts the mock tracer. This caused consumer tests to break when they check for leaked goroutines while using mocktracer.

Motivation

Fixes #2858.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

I've added go.uber.org/goleak as a dependency, which will need to be reviewed.

Unsure? Have a question? Request a review!

@ggambetti ggambetti changed the title Address ddtrace/mocktracker goroutine leaks internal/datastreams: fix Processor goroutine leaks Sep 18, 2024
@ggambetti ggambetti marked this pull request as ready for review September 18, 2024 18:23
@ggambetti ggambetti requested review from a team as code owners September 18, 2024 18:23
This ensures that none of the mocktracer tests will regress and start
leaking goroutines again. Requires installing goleak checks at the
package level.
@ggambetti
Copy link
Contributor Author

@darccio you self assigned the bug (#2858), would be able to take a look at this in the next week?

@darccio
Copy link
Member

darccio commented Sep 25, 2024

@ggambetti I'm taking a look right now. When merged, it'll be released in our October release.

Copy link
Member

@darccio darccio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@darccio darccio enabled auto-merge (squash) September 25, 2024 15:18
@darccio darccio disabled auto-merge September 26, 2024 07:27
@darccio darccio merged commit bed7121 into DataDog:main Sep 26, 2024
93 checks passed
MNThomson pushed a commit to agilebits/dd-trace-go that referenced this pull request Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] goroutine leak of datastreams.Processor from mocktracer
2 participants