ParsedExpressionsCache Corruption when running multiple concurrent evaluations
nlysaght opened this issue · comments
The ParsedExpressionsCache in the class DmnExecutionContext is defined as a static Dictionary which in single threaded environments works fine.
In the case where there are multiple evaluations happening at the same time we get concurrency exceptions being throw by the .NET runtime, as the cache is being modified as it's been read from.
I downloaded the code to evaluate what the problem may be and found that changing the ParsedExpressionsCache to a ConcurrentDictionary overcame this issue.
Hello @nlysaght,
I can confirm both the issue as well as the option of using the ConcurrentDictionary
. You can also refer to Issue #7 for more details - I think the workaround I described there may also help you.
I started with some "modernization" of the library that will include the support for the parallel execution, however - to be honest - don't have the time line yet
I keep the issue open as known issue
so it doesn't get "hidden" in closed ones and will post the updates here
Hi @adamecr , thanks for the quick response. I'm am happy to help with the of the modernisation if you feel the tasks can be split up appropriately.
the version 1 (1.0.0) was release - the package is published at NuGet and the master branch here is updated properly.
Closing the issue