-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Operations that change non-concurrent collections must have exclusive access at DynamicExpresso.Interpreter.SetIdentifier(Identifier identifier) #288
Comments
Do you have an example of code that can reproduce the issue? |
Code have to many dependences. |
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
<#288 (comment)>,
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. |
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!
The text was updated successfully, but these errors were encountered: