You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When invoking queries where one or more of the variable parameters is a dictionary, 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 dictionary variable because it treats it as an IEnumerable and ComparisonHelper.SequenceEqual only works for lists and not dictionaries so therefore returns false. 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).
Steps to reproduce
Steps to reproduce the behaviour:
Execute ExecuteAsync on a query which has a dictionary type variable parameter
After 2 or more completed executions of the above with identical parameters on that same query upon inspecting _operationExecutor -> _operationStore -> _results it will be observed that another result gets added after each time
Relevant log output
No response
Additional Context?
Expected behaviour
If one of the variables is a list type, the contents of that dictionary needs to iterated and compared so that the comparison when GetOrAdd is executed correctly recognises that is another call to the same query and therefore the existing result should updated, not another one added; i.e. Get is triggered not Add.
Desktop (please complete the following information):
OS: Windows 10
.net: 6.0/7.0
Additional context
Using 12.3.0 Strawberry Shake, but checking the code, latest remains affected by this bug.
Product
Strawberry Shake
Version
12.3.0
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Describe the bug
Related to #3513
When invoking queries where one or more of the variable parameters is a dictionary, 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 dictionary variable because it treats it as an IEnumerable and ComparisonHelper.SequenceEqual only works for lists and not dictionaries so therefore returns false. 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).
Steps to reproduce
Steps to reproduce the behaviour:
Relevant log output
No response
Additional Context?
Expected behaviour
If one of the variables is a list type, the contents of that dictionary needs to iterated and compared so that the comparison when GetOrAdd is executed correctly recognises that is another call to the same query and therefore the existing result should updated, not another one added; i.e. Get is triggered not Add.
Desktop (please complete the following information):
Additional context
Using 12.3.0 Strawberry Shake, but checking the code, latest remains affected by this bug.
Product
Strawberry Shake
Version
12.3.0
The text was updated successfully, but these errors were encountered: