You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there are multiple Event activities inside Fork and you trigger one of them other are left orphaned which later causes an error in WorkflowStateExtractor.ApplyActivityExecutionContextsAsync(WorkflowState state, WorkflowExecutionContext workflowExecutionContext) line 111: var parentContext = lookup[contextState.ParentContextId!];. ParentContextId is not empty here but lookup no longer contain this context.
Steps to Reproduce
Detailed Steps:
Given following workflow definition
Run worfklow instance (e.g. use endpoint /elsa/api/workflow-definitions/Test__DefinitionId/execute)
Trigger /events/trigger?t= for either "Retry" or "Ignore" branch (url is logged e.g. http://localhost/elsa/api/events/trigger?t=CfDJ8H-Kgs2hgapAogEBY0WJnMn3C2CpF175Qxvu1J-GD8SD66HN7xlYusEPDHxN5_uLpjKbHDMJOVbEfxn9rsEoTrAt8wkUiHCvAZyLf40P5gz91jlF9d9UEjQcU1zq85UBW5WlvG24lOaq4Y818KeVdzCf9pFGmx8eMlSbIfGo50NsJkFRhspWT5WSFOQ5P_ksnVHw0pvcDPrX2V7WGp7aCcI)
Try trigger "Finish" event (url is logged e.g. http://localhost/elsa/api/events/trigger?t=CfDJ8H-Kgs2hgapAogEBY0WJnMmKGIZFFNOylsIUEtMgq9j_sXY82A1mqQF0TVwbUurcITTV5AhovmWxKSIQvuoYknSMnQf_8lbXInctOCXpE68lGrUz8deDac7Zw98dLpTP03kcgxFHJ-LAXNwNkBFlFWd8dU6hQfkvBy3Ahz4l4gzr21Po4pWZbDjKLDs7L9dmikmhTLZ2VBC5MZTIG9jlpNc
Observer error (key not found in dictionary).
2024-12-02 16:07:23.3108 [Microsoft.AspNetCore.Diagnostics.DiagnosticsTelemetry.ReportUnhandledException:0][ERROR][0HN8ISC0LJJVI:00000003] An unhandled exception has occurred while executing the request. System.Collections.Generic.KeyNotFoundException: The given key 'd46668af5713ed03' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Elsa.Workflows.WorkflowStateExtractor.ApplyActivityExecutionContextsAsync(WorkflowState state, WorkflowExecutionContext workflowExecutionContext)
at Elsa.Workflows.WorkflowStateExtractor.ApplyAsync(WorkflowExecutionContext workflowExecutionContext, WorkflowState state)
at Elsa.Workflows.WorkflowExecutionContext.CreateAsync(IServiceProvider serviceProvider, WorkflowGraph workflowGraph, WorkflowState workflowState, String correlationId, String parentWorkflowInstanceId, IDictionary`2 input, IDictionary`2 properties, ExecuteActivityDelegate executeDelegate, String triggerActivityId, CancellationToken cancellationToken)
at Elsa.Workflows.WorkflowRunner.RunAsync(WorkflowGraph workflowGraph, WorkflowState workflowState, RunWorkflowOptions options, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.LocalWorkflowClient.RunInstanceAsync(RunWorkflowInstanceRequest request, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.StimulusSender.ResumeExistingWorkflowsAsync(String stimulusHash, StimulusMetadata metadata, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.StimulusSender.SendAsync(String stimulusHash, StimulusMetadata metadata, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.EventPublisher.PublishAsync(String eventName, String correlationId, String workflowInstanceId, String activityInstanceId, Object payload, CancellationToken cancellationToken)
at Elsa.Workflows.Api.Endpoints.Events.TriggerPublic.Trigger.HandleAsync(CancellationToken cancellationToken)
at FastEndpoints.Endpoint`2.ExecAsync(CancellationToken ct)
at FastEndpoints.Endpoint`2.ExecAsync(CancellationToken ct)
at Elsa.Http.Middleware.HttpWorkflowsMiddleware.InvokeAsync(HttpContext httpContext, IServiceProvider serviceProvider)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
Expected Behavior
In version 3.2.3 this is working as intended. Triggering either of the fork branches removes other branches from context and next trigger completes the workflow.
ozzyrys
changed the title
[BUG] 3.3.0rc2 Stimulus api leaves orphaned entries in activity execution context
[BUG] 3.3.0rc2 Stimulus api leaves orphaned entries in activity execution context when triggering events in Fork
Dec 2, 2024
Description
If there are multiple
Event
activities insideFork
and you trigger one of them other are left orphaned which later causes an error inWorkflowStateExtractor.ApplyActivityExecutionContextsAsync(WorkflowState state, WorkflowExecutionContext workflowExecutionContext)
line 111:var parentContext = lookup[contextState.ParentContextId!];
.ParentContextId
is not empty here but lookup no longer contain this context.Steps to Reproduce
Given following workflow definition
/elsa/api/workflow-definitions/Test__DefinitionId/execute
)/events/trigger?t=
for either "Retry" or "Ignore" branch (url is logged e.g.http://localhost/elsa/api/events/trigger?t=CfDJ8H-Kgs2hgapAogEBY0WJnMn3C2CpF175Qxvu1J-GD8SD66HN7xlYusEPDHxN5_uLpjKbHDMJOVbEfxn9rsEoTrAt8wkUiHCvAZyLf40P5gz91jlF9d9UEjQcU1zq85UBW5WlvG24lOaq4Y818KeVdzCf9pFGmx8eMlSbIfGo50NsJkFRhspWT5WSFOQ5P_ksnVHw0pvcDPrX2V7WGp7aCcI
)http://localhost/elsa/api/events/trigger?t=CfDJ8H-Kgs2hgapAogEBY0WJnMmKGIZFFNOylsIUEtMgq9j_sXY82A1mqQF0TVwbUurcITTV5AhovmWxKSIQvuoYknSMnQf_8lbXInctOCXpE68lGrUz8deDac7Zw98dLpTP03kcgxFHJ-LAXNwNkBFlFWd8dU6hQfkvBy3Ahz4l4gzr21Po4pWZbDjKLDs7L9dmikmhTLZ2VBC5MZTIG9jlpNc
Expected Behavior
In version
3.2.3
this is working as intended. Triggering either of the fork branches removes other branches from context and next trigger completes the workflow.Environment
Project with reproduction
WorkflowsElsa3.zip
The text was updated successfully, but these errors were encountered: