-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[cmd/opampsupervisor] Fix memory leak and enable goleak #30496
Merged
evan-bradley
merged 5 commits into
open-telemetry:main
from
crobert-1:goleak_opampsupervisor
Jan 29, 2024
Merged
[cmd/opampsupervisor] Fix memory leak and enable goleak #30496
evan-bradley
merged 5 commits into
open-telemetry:main
from
crobert-1:goleak_opampsupervisor
Jan 29, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
requested review from
atoulme,
evan-bradley and
tigrannajaryan
January 12, 2024 23:08
crobert-1
changed the title
[cmd/opampsupervisor] Enable goleak
[chore][cmd/opampsupervisor] Enable goleak
Jan 12, 2024
crobert-1
force-pushed
the
goleak_opampsupervisor
branch
from
January 16, 2024 19:18
778e4b0
to
ea4653e
Compare
crobert-1
changed the title
[chore][cmd/opampsupervisor] Enable goleak
[cmd/opampsupervisor] Fix memory leak and enable goleak
Jan 16, 2024
evan-bradley
approved these changes
Jan 29, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catches! Thank you.
Thanks for your patience with the review. Could you rebase on main? |
crobert-1
force-pushed
the
goleak_opampsupervisor
branch
from
January 29, 2024 20:08
4907df7
to
f676598
Compare
Done 👍 |
cparkins
pushed a commit
to AmadeusITGroup/opentelemetry-collector-contrib
that referenced
this pull request
Feb 1, 2024
…ry#30496) **Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> `NewSupervisor` starts two goroutines, one for the health check ticker and another running the agent process. Each was causing a leak. To resolve the health check ticker goroutine leak a `Stop` call has been added to it during shutdown. To resolve the agent process leak a wait group has been added (to make sure shutdown blocks until the agent process is completely shutdown), and a `break` statement has been changed to `return`. The `break` statement was only breaking out of the `select` statement, but since it's nested within a `for` loop, the loop just kept going instead of completing successfully. This also enables `goleak` checks for `cmd/opampsupervisor` and `cmd/opampsupervisor/supervisor` packages **Link to tracking Issue:** <Issue number if applicable> open-telemetry#30438 **Testing:** <Describe what testing was performed and which tests were added.> Existing tests and new `goleak` checks are passing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
NewSupervisor
starts two goroutines, one for the health check ticker and another running the agent process. Each was causing a leak. To resolve the health check ticker goroutine leak aStop
call has been added to it during shutdown. To resolve the agent process leak a wait group has been added (to make sure shutdown blocks until the agent process is completely shutdown), and abreak
statement has been changed toreturn
. Thebreak
statement was only breaking out of theselect
statement, but since it's nested within afor
loop, the loop just kept going instead of completing successfully.This also enables
goleak
checks forcmd/opampsupervisor
andcmd/opampsupervisor/supervisor
packagesLink to tracking Issue:
#30438
Testing:
Existing tests and new
goleak
checks are passing.