-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
server: close the temporary session in HTTP API to avoid memory leak #24339
Merged
Merged
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
51708c7
server,session: do not create stats collector in HTTP api to avoid me…
tiancaiamao 9191316
fix CI
tiancaiamao 3629b06
address comment
tiancaiamao 0d757d0
Merge branch 'master' into stats-leak
tiancaiamao 818d532
address comment
tiancaiamao cf7b6d4
Merge branch 'master' into stats-leak
qw4990 981e3c5
Merge branch 'master' into stats-leak
ti-chi-bot abdeccd
Merge branch 'master' into stats-leak
ti-chi-bot 96b7f23
Merge branch 'master' into stats-leak
ti-chi-bot 36f6992
Merge branch 'master' into stats-leak
ti-chi-bot e3f24f1
Merge branch 'master' into stats-leak
ti-chi-bot 4bea4de
Merge branch 'master' into stats-leak
ti-chi-bot ca76788
Merge branch 'master' into stats-leak
ti-chi-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
Seems like the root cause of the memory leak is that there is no
session.Close()
called for thissession
, sos.statsCollector.Delete()
is not triggered to release the stats collector. Would there be other potential leaks caused by not closing this session?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.
I'm not sure. I wonder is it really necessary to create a temporary session here? Maybe that's a better fix, what's your opinion?
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.
Agree with @eurekaka .
Calling
session.Close()
when exiting from these HTTP APIs seems a safer and clearer way to solve this issue.If we add another global resource into
session
likestatsCollector
, then this problem will occur again if using this way.