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

Leak in as_batch_read_execute #62

Closed
tang0on opened this issue Mar 17, 2017 · 2 comments
Closed

Leak in as_batch_read_execute #62

tang0on opened this issue Mar 17, 2017 · 2 comments

Comments

@tang0on
Copy link

tang0on commented Mar 17, 2017

Hello, everyone! I'm writing a c++ wrapper around your library, and after I've implemented some batch operations using aerospike_batch_read_async, I've noticed continuously increasing memory consumption of my application in production environment. Here is how it looks like:

screenshot_20170316_164833

It is heaptrack_gui visualization, and lowest rasing area is memory allocated by as_vector_increase_capacity (plateau on right side is because of very low rps at night). Also heaptrack was able to tell where allocations occure:

screenshot_20170316_172235

I'm sorry for screenshots, but profiling took about day, and log takes over 6GB.
It seems that sometimes uneven distribution of keys among nodes (in case of n_nodes >= 2) occurs, which leads to overflowing capacity of some as_batch_node.offsets (which are allocated on stack or heap, depending on n_keys value), which leads to implicit copying to the heap, and nobody takes care of that memory. I've made pull request and I'd be appreciate if you take a look at it. I currently run my application with patched library and it looks like problem has gone ;)

@BrianNichols
Copy link
Member

Yes, as_batch_read_execute() will leak memory when the batch offsets vector exceeds it's initial capacity (like when batch size exceeds 5000). Your fix is correct. We will issue a new release after an unrelated issue is tracked down.

BrianNichols added a commit that referenced this issue Apr 4, 2017
Run query in current thread if pool size == 0
@BrianNichols
Copy link
Member

C client has been released which contains your fix.

http://www.aerospike.com/download/client/c/4.1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants