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

Fix OperationRequest equality #3541

Merged
merged 6 commits into from
Apr 19, 2021
Merged

Conversation

PascalSenn
Copy link
Member

Follow up pr for #3540, based on #3514

@davidbrazel2 I couldn't push into your branch, so I opened a new Pull Request. In #3540 I added object equality for input objects. I also added support for nested lists to you PR.
Good Work! Thanks for the contribution!

davidbrazel2 and others added 3 commits April 16, 2021 12:10
When invoking queries where one or more of the variable parameters is a list, this causes every repeat execution of the query to add another operation result to the operation store after every completed ExecuteAsync request. This is caused by the fact that the call to GetOrAddStoredOperation in OperationStore performs a GetOrAdd on the ConcurrentDictionary<OperationRequest, IStoredOperation> _result, the .Equals equality comparison within the OperationRequest object that acts as the key and thus invoked by GetOrAdd, when comparing the content of variables will always return false with a list variable because a new list instance is instantiated on every ExecuteAsync; only a a.Equals(b) is applied to the list, which is always a comparison of 2 different list objects. The result is that every invocation adds another item to _results which will keep growing indefinitely, triggering a memory leak as well as higher and higher cpu usage (every time more items in _results needs to be compared to).
@michaelstaib michaelstaib merged commit 8abe21d into main Apr 19, 2021
@michaelstaib michaelstaib deleted the db/fix-list-type-param-compare branch April 19, 2021 15:18
@sonarcloud
Copy link

sonarcloud bot commented Apr 19, 2021

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

Successfully merging this pull request may close these issues.

3 participants