aelassas / wexflow

.NET Workflow Engine and Automation Platform
https://wexflow.github.io
MIT License
554 stars 159 forks source link

Workflow Instances #81

Closed HasanBsone closed 3 weeks ago

HasanBsone commented 1 month ago

We are trying to Run workflow instances from restapi so we are getting error like this the item 1 is already added in The Dictionary and Some time's my values are not present in rest variables and sometime's it's running fine can you please guide

aelassas commented 1 month ago

I need more details to reproduce the issue. You are running multiple parallel workflow instances from rest api and sometimes you get an error and sometimes it works? right?

Can you describe what your workflow does? is it a long running workflow so multiple instances are runninng in parallel? You can simulate this with Wait task.

HasanBsone commented 1 month ago

basically what we are doing is we are calling same workflow again and again through restapi so multiple instances are running of workflow but those restvariables keys are same but with different values. our workflow is just simply saving a data in database and finished so it's not long running workflow.We are actually doing is that we are saving data in our database and on our saving method which is devexpress builtin method we are running your wexflow. and wexflow task is saving the data in other table.

For Example if 10 objects is going to save in database so for each object on save method will call restapi for running wexflow

HasanBsone commented 1 month ago

Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added. Key: 3 at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value) at Wexflow.Core.Task..ctor(XElement xe, Workflow wf) in /_/src/netcore/Wexflow.Core/Task.cs:line 87 at Wexflow.Tasks.CreateTaskCommissionIssue.CreateTaskCommissionIssue..ctor(XElement xe, Workflow wf) at InvokeStubCreateTaskCommissionIssue..ctor(Object, Span`1) at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) --- End of inner exception stack trace --- at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at System.Activator.CreateInstance(Type type, Object[] args) at Wexflow.Core.Workflow.Load(String xml) in //src/netcore/Wexflow.Core/Workflow.cs:line 584 at Wexflow.Core.Workflow.StartSync(String startedBy, Guid instanceId, Boolean& resultWarning) in /_/src/netcore/Wexflow.Core/Workflow.cs:line 1018 at Wexflow.Core.Workflow.<>c__DisplayClass204_0.b_0() in //src/netcore/Wexflow.Core/Workflow.cs:line 992 2024-08-14 12:29:17,395 INFO [16] - [WorkflowComissionIssue / 1] Workflow started - Instance Id: cf89f49c-ab83-45d1-b9d8-1dd0b0f7fc10

HasanBsone commented 1 month ago

i am using 6.0.0 nuget package wexflow and i am hitting same workflow again and again with restapi call

aelassas commented 1 month ago

I have done some testing on the latest version (7.9) and couldn't reproduce your issue.

Can you show me your workflow in XML format?

Task Ids must be unique, Make sure you have unique integer values for your task id in your workflow.

HasanBsone commented 1 month ago

I have shared the xml format the there is only one task in my workflow when two thread accessing same workflow then this thing is happen.i am saving data in database in my task on every restapi call when i put thread.sleep in between restapi calls so error chances are totally less.

HasanBsone commented 1 month ago

if you want me to show this issue on my PC so we can also do this..

aelassas commented 1 month ago

@HasanBsone I reproduced and fixed the issue. I released a patch: v8.0

Test it and let me know if the issue is resolved on your side as well.

HasanBsone commented 1 month ago

Thank's alot i will try then let you know.. will it be working on .net 6.0? because we are using .Net 6.0

aelassas commented 1 month ago

I released a new patch for this issue: v8.1

You should test with this one.

HasanBsone commented 3 weeks ago

Hello Aelassas this nuget package is not fully compatiable with .net6.0 will it work for me in testing? i am starting testing

aelassas commented 3 weeks ago

No you need .net 8.0 or above.

HasanBsone commented 2 weeks ago

The Bug is fixed i am not getting taskitem library error. i am using wexflow 6.0 nuget with your given wexflow server new patch.But some times when we continuously hit restapi i am not getting RestVariables in some api call.please assist

aelassas commented 2 weeks ago

But some times when we continuously hit restapi i am not getting RestVariables in some api call.please assist

Open a new issue for that.