Open Igor0894 opened 1 year ago
Do you have an example of code that can reproduce the issue?
Do you have an example of code that can reproduce the issue?
Do you have an example of code that can reproduce the issue?
Code have to many dependences. Probably now I think it causes in Parralel.For loop... May be change _identifiers type Dictionary to ConcurrentDictionary for thread safe changes?
Does your external code have a single interpreter instance being called by multiple threads?
On Thu, Jun 8, 2023, 10:49 AM Igor0894 @.***> wrote:
Do you have an example of code that can reproduce the issue?
Do you have an example of code that can reproduce the issue?
Code have to many dependences. Probably now I think it causes in Parralel.For loop... May be change _identifiers type Dictionary to ConcurrentDictionary for thread safe changes?
— Reply to this email directly, view it on GitHub https://github.com/dynamicexpresso/DynamicExpresso/issues/288#issuecomment-1582860661, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2QVXQNB7JDR6Y3L5MPS3MLXKHX6ZANCNFSM6AAAAAAY7IVZ2A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
DynamicExpresso requires to have the Interpreter class modified in an initialization phase. See https://github.com/AmikoRD/respiro-be-orders/deployments
If you call SetIdentifier only on one thread, but in the meantime other threads access it you could have problems.
You should first create the Interpreter class with all identifiers, then you can access it (calling only Parse or Eval functions) from multiple threads without problems.
Does your external code have a single interpreter instance being called by multiple threads?
On Thu, Jun 8, 2023, 10:49 AM Igor0894 @.***> wrote:
Do you have an example of code that can reproduce the issue?
Do you have an example of code that can reproduce the issue?
Code have to many dependences. Probably now I think it causes in Parralel.For loop... May be change _identifiers type Dictionary to ConcurrentDictionary for thread safe changes?
— Reply to this email directly, view it on GitHub https://github.com/dynamicexpresso/DynamicExpresso/issues/288#issuecomment-1582860661, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2QVXQNB7JDR6Y3L5MPS3MLXKHX6ZANCNFSM6AAAAAAY7IVZ2A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Yes
Hello! Sometimes I have a problem with non thread safe Dictionary (but I Interpreter.SetVariable in one thread):
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. at System.Collections.Generic.Dictionary
2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary
2.set_Item(TKey key, TValue value) at DynamicExpresso.Interpreter.SetIdentifier(Identifier identifier)I see that _identifiers in ParserSettings typeof Dictionary, but I dont know why I need concurent dict If i use in one thread..
Help me please!