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

storage did not release memory #3601

Closed
cangfengzhs opened this issue Dec 30, 2021 · 5 comments · Fixed by #3666
Closed

storage did not release memory #3601

cangfengzhs opened this issue Dec 30, 2021 · 5 comments · Fixed by #3666
Assignees
Labels
priority/hi-pri Priority: high type/bug Type: something is unexpected
Milestone

Comments

@cangfengzhs
Copy link
Contributor

cangfengzhs commented Dec 30, 2021

Describe the bug (required)

All of the Expression are allocated in ObjectPool. And, when creating a tag/edge who contain a prop with a default value, the default value is stored as an Expressoin in Schema.

In graphd, the ObjectPool is created in every query, and released after query. But, in MetaClient, the pool is created when load schema, and released when reload schema if there is any update about schema. So, if schema is never never updated, the pool will never be released.

When writing any data who has a default value and ngql not fill it, storaged will compute default value. But, the Expression about default value will be clone and allocated in MetaClient's pool. This causes the pool to take up more and more memory, and it will never be released unless the schema is changed.

@cangfengzhs cangfengzhs added type/bug Type: something is unexpected priority/hi-pri Priority: high labels Dec 30, 2021
@Sophie-Xie Sophie-Xie added this to the v3.0.0 milestone Dec 30, 2021
@Shylock-Hg
Copy link
Contributor

But, the Expression about default value will be clone and allocated in MetaClient's pool.
Why need clone it?

@cangfengzhs
Copy link
Contributor Author

I'm not sure if Expression is stateful. If it is not, clone is really not needed.

@Shylock-Hg
Copy link
Contributor

I'm not sure if Expression is stateful. If it is not, clone is really not needed.

It's stateful. Expression will store the evaluate result to get performance improvement.

@cangfengzhs
Copy link
Contributor Author

In addition, if the schema is updated and reloaded during the use of the default value, there will be a concurrency safety problem. The memory pointed to by Expression* in default value may have been released

@cangfengzhs
Copy link
Contributor Author

cangfengzhs commented Dec 30, 2021

It's stateful. Expression will store the evaluate result to get performance improvement.

So, clone is needed. Multi thread may be evaluate expression at same time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/hi-pri Priority: high type/bug Type: something is unexpected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants