Skip to content

Az482 fix intersection mem leak #66

Merged
merged 1 commit into from Jul 1, 2011

2 participants

@rzezeski

az482

In the select_fun for the intersection_op (i.e. AND) it would stop
once one of it's iterators had been exhausted but would leave the
other one as is, messages and all. So in the case where one side is
empty and other side has a bunch of results (or this query is run a
lot, memory usage = result size * # of queries) the results just sit
on a process that waits indefinitely for something to pull the results
off it's mailbox. The reason this doesn't occur if you use a PB conn
for each transaction is because he PB conn is the parent of these
processes and they are all linked. If it dies they all die.

The solution is to make sure all iterators are exhausted.

@rzezeski rzezeski Exhaust all iterators to avoid memory leak
az482

In the select_fun for the intersection_op (i.e. AND) it would stop
once one of it's iterators had been exhausted but would leave the
other one as is, messages and all. So in the case where one side is
empty and other side has a bunch of results (or this query is run a
lot, memory usage = result size * # of queries) the results just sit
on a process that waits indefinitely for something to pull the results
off it's mailbox.  The reason this doesn't occur if you use a PB conn
for each transaction is because he PB conn is the parent of these
processes and they are all linked.  If it dies they all die.

The solution is to make sure all iterators are exhausted.
cd910c2
@rustyio
rustyio commented Jul 1, 2011

Looks good. Verified using https://github.com/gordyt/riaksearch-test.

@rzezeski rzezeski merged commit 7036e82 into riak_search-0.14 Jul 1, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.