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

Span logger leaks memory in infinite watching server.Find case #1085

Open
Bolodya1997 opened this issue Sep 21, 2021 · 3 comments
Open

Span logger leaks memory in infinite watching server.Find case #1085

Bolodya1997 opened this issue Sep 21, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Bolodya1997
Copy link

Bolodya1997 commented Sep 21, 2021

Current Behavior

In infinite watching server.Find case span logger just collects logs and doesn't push them. It leads to unlimited memory growth in registry server.

Issue in code

In infinite case defer never happens:

ctx, finish := withLog(ctx, operation)
defer finish()

pprof output

registry-k8s-5b77d84b85-lgxn4.pb.gz

Possible solution

Instead of having single span in such case we can handle such hierarchy:

[root span] - empty
[child span 1] .. [child span n] - with data

So all of [child spans] will refer to the single [root span] and will be pushed with some timeout or with some amount of logs collected. [root span] will always be empty so there will be no memory leak.

@Bolodya1997 Bolodya1997 added the bug Something isn't working label Sep 21, 2021
@denis-tingaikin
Copy link
Member

denis-tingaikin commented Sep 21, 2021

Could you please attach something from logs, build links, pictures, source code links from your research?

@denis-tingaikin denis-tingaikin added the invalid This doesn't seem right label Sep 21, 2021
@Bolodya1997
Copy link
Author

Could you please attach something from logs, build links, pictures, source code links from your research?

Added link to code and pprof output.

@Mixaster995
Copy link
Contributor

Tried to investigate this problem - can't reproduce leaks.
Probably requires really long-time running setup or some special tweaks imitating leaks.
Since problem don't look critical at this moment, so i postponed investigation
Prepared draft PR with possible solution that should fix this problem - #1108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants