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
fix(kuma-cp): don't leak goroutine on every tick in SimpleWatchdog #7348
Merged
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
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi
requested review from
jakubdyszkiewicz,
lobkovilya and
michaelbeaumont
and removed request for
a team
July 25, 2023 21:50
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
michaelbeaumont
force-pushed
the
fix-leaking-goroutine
branch
from
July 26, 2023 07:26
b2697e7
to
3721605
Compare
…utine on cancel Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
michaelbeaumont
force-pushed
the
fix-leaking-goroutine
branch
from
July 26, 2023 07:26
3721605
to
87da0a7
Compare
michaelbeaumont
changed the title
fix(kuma-cp): don't spawn new goroutine on every tick in SimpleWatchdog
fix(kuma-cp): don't leak goroutine on every tick in SimpleWatchdog
Jul 26, 2023
lahabana
approved these changes
Jul 26, 2023
lahabana
added
the
ci/run-full-matrix
PR: Runs all possible e2e test combination (expensive use carefully)
label
Jul 26, 2023
kumahq bot
pushed a commit
that referenced
this pull request
Jul 26, 2023
…7348) * fix(kuma-cp): ensure we call cancel on watchdog tick scope, exit goroutine on cancel Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com> Signed-off-by: Mike Beaumont <mjboamail@gmail.com> Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
This was referenced Jul 26, 2023
kumahq bot
pushed a commit
that referenced
this pull request
Jul 26, 2023
…7348) * fix(kuma-cp): ensure we call cancel on watchdog tick scope, exit goroutine on cancel Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com> Signed-off-by: Mike Beaumont <mjboamail@gmail.com> Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
kumahq bot
pushed a commit
that referenced
this pull request
Jul 26, 2023
…7348) * fix(kuma-cp): ensure we call cancel on watchdog tick scope, exit goroutine on cancel Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com> Signed-off-by: Mike Beaumont <mjboamail@gmail.com> Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
kumahq bot
pushed a commit
that referenced
this pull request
Jul 26, 2023
…7348) * fix(kuma-cp): ensure we call cancel on watchdog tick scope, exit goroutine on cancel Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com> Signed-off-by: Mike Beaumont <mjboamail@gmail.com> Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
kumahq bot
pushed a commit
that referenced
this pull request
Jul 26, 2023
…7348) * fix(kuma-cp): ensure we call cancel on watchdog tick scope, exit goroutine on cancel Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com> Signed-off-by: Mike Beaumont <mjboamail@gmail.com> Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
michaelbeaumont
added a commit
that referenced
this pull request
Jul 26, 2023
…ackport of #7348) (#7355) fix(kuma-cp): don't leak goroutine on every tick in SimpleWatchdog (#7348) * fix(kuma-cp): ensure we call cancel on watchdog tick scope, exit goroutine on cancel Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com> Signed-off-by: Mike Beaumont <mjboamail@gmail.com> Co-authored-by: Łukasz Dziedziak <lukidzi@gmail.com> Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
michaelbeaumont
added a commit
that referenced
this pull request
Jul 26, 2023
…ackport of #7348) (#7352) fix(kuma-cp): don't leak goroutine on every tick in SimpleWatchdog (#7348) * fix(kuma-cp): ensure we call cancel on watchdog tick scope, exit goroutine on cancel Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com> Signed-off-by: Mike Beaumont <mjboamail@gmail.com> Co-authored-by: Łukasz Dziedziak <lukidzi@gmail.com> Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
michaelbeaumont
added a commit
that referenced
this pull request
Jul 26, 2023
…ackport of #7348) (#7351) fix(kuma-cp): don't leak goroutine on every tick in SimpleWatchdog (#7348) * fix(kuma-cp): ensure we call cancel on watchdog tick scope, exit goroutine on cancel Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com> Signed-off-by: Mike Beaumont <mjboamail@gmail.com> Co-authored-by: Łukasz Dziedziak <lukidzi@gmail.com> Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Checklist prior to review
While debugging some performance issue I've noticed that Kuma creates thousands of goroutines that might grow indefinitely. Whenever clients connect to KDS create an instance of
SimpleWatchdog
which is responsible for configuration generation. It's triggered every second and generates a snapshot which later puts into the cache. Lately, while implementing better context cancelation we introduced a change in aSimpleWatchdog
which creates a new goroutine responsible for listing stop events and canceling the context. Goroutine is spawned in a loop and every second there was a new goroutine created which was listening events. In the case of KDS this code was running until the zone disconnects(disconnect cleaned up all the goroutines), and because connections are long-lasting it might create over 200k+ goroutines. It seems to be relevant to all the code usingSimpleWatchdog
. I am not sure if that fix handling all the cases correctly but while testing I've noticed that there is no more leak.Before 1 zone connected for over a 1min:
After fix:
syscall.Mkfifo
have equivalent implementation on the other OS --UPGRADE.md
? --> Changelog:
entry here or add aci/
label to run fewer/more tests?