Skip to content
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

[Bug] ELSA 3.2.1 Serialization of workflow instances / Object list properties with MongoDb no longer working, circular references... #6049

Open
JochenSteinbrenner opened this issue Oct 22, 2024 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@JochenSteinbrenner
Copy link

Description

I have created a custom function findEntities which returns a List<ExpandoObject> within Jint engine.
With Version ELSA 3.2, I can call the function within a JavaScript activity. The result can be persisted within a variable using
the setVariable(..) method. For example:
setVariable("MyArray", findEntities("x => x.Template != null"));
The MyArray variable is correctly persisted within the WorkflowState.

After update to Version ELSA 3.2.1, this leads to Maximum serialization depth exceeded within WorkflowInstance persistence...
Refer to attached log file...

Error: An error occurred while serializing the WorkflowState property of class Elsa.Workflows.Management.Entities.WorkflowInstance: An error occurred while serializing the ActivityExecutionContexts property of class Elsa.Workflows.State.WorkflowState: An error occurred while serializing the Properties property of class Elsa.Workflows.State.ActivityExecutionContextState: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: Maximum serialization depth exceeded (does the object being serialized have a circular reference?).'

At the moment, within ELSA 3.2.1 it is impossible to persist any arrays within a workflow instance variable

Are the any breaking changes within WorkflowInstance Persistance? Critical bug?

Steps to Reproduce

Try to store an array property using the JavaScript activity and the setVariable method. For example

  • Add JavaScript activity to workflow
  • Create the Variable: MyArray with type object and WorkflowInstance persistance
  • Call script:
let myArray = ([
    1,2,3,4,5,6
])
setVariable("MyArray", myArray);

Reproduction Rate:

  • No error with ELSA 3.2
  • Always with ELSA 3.2.1
@JochenSteinbrenner JochenSteinbrenner added the bug Something isn't working label Oct 22, 2024
@sfmskywalker sfmskywalker moved this to Triage in ELSA 3 Oct 26, 2024
@sfmskywalker sfmskywalker added this to the Elsa 3.2.2 milestone Oct 26, 2024
@JochenSteinbrenner
Copy link
Author

Still bugs in serialization within version 3.2.3. This breaks my whole program :(

2024-11-13 16:05:22.005 [AZO.KastorEngine.Server][8.1003.0.825] [Error] [WorkflowElsaSystem] An error occurred while deserializing the WorkflowState property of class Elsa.Workflows.Management.Entities.WorkflowInstance: An error occurred while deserializing the ActivityExecutionContexts property of class Elsa.Workflows.State.WorkflowState: An error occurred while deserializing the Properties property of class Elsa.Workflows.State.ActivityExecutionContextState: Type 'System.Text.Json.Nodes.JsonArray' does not have a suitable constructor or Add method.
AZO.KastorEngine.Systems.Workflow.Exceptions.EcsWorkflowFaultedException: An error occurred while deserializing the WorkflowState property of class Elsa.Workflows.Management.Entities.WorkflowInstance: An error occurred while deserializing the ActivityExecutionContexts property of class Elsa.Workflows.State.WorkflowState: An error occurred while deserializing the Properties property of class Elsa.Workflows.State.ActivityExecutionContextState: Type 'System.Text.Json.Nodes.JsonArray' does not have a suitable constructor or Add method.
   at AZO.KastorEngine.Systems.WorkflowElsa.WorkflowElsaSystem.SetOutput(EcsEntity entity, WorkflowState workflowState, Boolean mustFinish, Boolean cancelled) in /src/AZO.KastorEngine/Systems/WorkflowElsa/WorkflowElsaSystem.cs:line 628
   at AZO.KastorEngine.Systems.WorkflowElsa.WorkflowElsaSystem.TryResumeWorkflowInstance(EcsEntity entity, String bookmarkId, WorkflowState& workflowState, Dictionary`2 inputParameters, Boolean mustFinish) in /src/AZO.KastorEngine/Systems/WorkflowElsa/WorkflowElsaSystem.cs:line 929
   at AZO.KastorEngine.Systems.WorkflowElsa.WorkflowElsaSystem.TryResumeWorkflowInstance(Guid entityGuid, String bookmarkId, WorkflowState& workflowState, Dictionary`2 inputParameters, Boolean mustFinish) in /src/AZO.KastorEngine/Systems/WorkflowElsa/WorkflowElsaSystem.cs:line 1013
   at AZO.KastorEngine.Systems.WorkflowElsa.WorkflowElsaSystem.<>c__DisplayClass48_1.<Execute>b__0() in /src/AZO.KastorEngine/Systems/WorkflowElsa/WorkflowElsaSystem.cs:line 1321
   at AZO.KastorEngine.Systems.Entity.EntitySystem.WithTransaction(Action callback) in /src/AZO.KastorEngine/Systems/Entity/EntitySystem.cs:line 590
--- End of stack trace from previous location ---
   at AZO.KastorEngine.Systems.Entity.EntitySystem.WithTransaction(Action callback) in /src/AZO.KastorEngine/Systems/Entity/EntitySystem.cs:line 689
   at AZO.KastorEngine.Systems.Entity.EntitySystem.WithLockedTransaction(Action callback, Guid lockGuid, Boolean tryLock) in /src/AZO.KastorEngine/Systems/Entity/EntitySystem.cs:line 568
   at AZO.KastorEngine.Systems.WorkflowElsa.WorkflowElsaSystem.Execute() in /src/AZO.KastorEngine/Systems/WorkflowElsa/WorkflowElsaSystem.cs:line 1315
   at AZO.KastorEngine.EcsServiceWithoutTrans`2.Execute(ISystem system, IServiceScope serviceScope) in /src/AZO.KastorEngine/Infrastructure/EcsServiceWithoutTrans.cs:line 52
   at AZO.KastorEngine.EcsHostedServiceBase`2.<>c__DisplayClass21_0.<ExecuteIntern>b__0() in /src/AZO.KastorEngine/Infrastructure/EcsHostedServiceBase.cs:line 225
   at AZO.Diagnostics.Debug.Trace(Action callback, String debugContext, String message, Object[] additionalParams, ITraceConfig config, Stopwatch stopwatch)
   at AZO.KastorEngine.EcsHostedServiceBase`2.ExecuteIntern(CancellationToken cancellationToken)

@JochenSteinbrenner
Copy link
Author

Please help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Triage
Development

No branches or pull requests

2 participants