elsa-workflows / elsa-workflows/elsa-core

Class(DelayActivityExecutionContextExtensions)Fuction(DelayFor)Error

Open
#6,757 1 comment 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

When a large number of bookmarks(500+) created by DelayFor are triggered, creating new DelayFor bookmarks results in an error:
​​"Index was outside the bounds of the array."​​

​StackTrace:​​
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at Elsa.Scheduling.Services.DefaultWorkflowScheduler.ScheduleAtAsync(String taskName, ScheduleExistingWorkflowInstanceRequest request, DateTimeOffset at, CancellationToken cancellationToken) at Elsa.Scheduling.Services.DefaultBookmarkScheduler.ScheduleAsync(String workflowInstanceId, IEnumerable1 bookmarks, CancellationToken cancellationToken)
at Elsa.Scheduling.Handlers.ScheduleWorkflows.HandleAsync(WorkflowBookmarksIndexed notification, CancellationToken cancellationToken)
at Elsa.Mediator.PublishingStrategies.SequentialProcessingStrategy.PublishAsync(NotificationStrategyContext context)
at Elsa.Mediator.Middleware.Notification.Components.NotificationHandlerInvokerMiddleware.InvokeAsync(NotificationContext context)
at Elsa.Mediator.Middleware.Notification.NotificationPipeline.ExecuteAsync(NotificationContext context)
at Elsa.Mediator.Services.DefaultMediator.SendAsync(INotification notification, IEventPublishingStrategy strategy, CancellationToken cancellationToken)
at Elsa.Mediator.Services.DefaultMediator.SendAsync(INotification notification, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.BookmarksPersister.PersistBookmarksAsync(UpdateBookmarksRequest updateBookmarksRequest)
at Elsa.Workflows.Runtime.DefaultCommitStateHandler.CommitAsync(WorkflowExecutionContext workflowExecutionContext, WorkflowState workflowState, CancellationToken cancellationToken)
at Elsa.Workflows.WorkflowRunner.RunAsync(WorkflowExecutionContext workflowExecutionContext)
at Elsa.Workflows.WorkflowRunner.RunAsync(WorkflowGraph workflowGraph, RunWorkflowOptions options, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.WorkflowInvoker.InvokeAsync(WorkflowGraph workflowGraph, RunWorkflowOptions options, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.Activities.ExecuteWorkflow.ExecuteWorkflowAsync(ActivityExecutionContext context, Boolean waitForCompletion)
at Elsa.Workflows.Runtime.Activities.ExecuteWorkflow.ExecuteAsync(ActivityExecutionContext context)
at Elsa.Workflows.Activity.Elsa.Workflows.IActivity.ExecuteAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.DefaultActivityInvokerMiddleware.ExecuteActivityAsync(ActivityExecutionContext context)
at Elsa.Workflows.Runtime.Middleware.Activities.BackgroundActivityInvokerMiddleware.ExecuteActivityAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.DefaultActivityInvokerMiddleware.InvokeAsync(ActivityExecutionContext context)
at Elsa.Workflows.Runtime.Middleware.EvaluateLogPersistenceModesMiddleware.InvokeAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.NotificationPublishingMiddleware.InvokeAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.ExecutionLogMiddleware.InvokeAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.ExceptionHandlingMiddleware.InvokeAsync(ActivityExecutionContext context)

This appears to be a concurrency issue in Elsa's bookmark scheduling system when handling bulk DelayFor operations. The error suggests a dictionary capacity overflow during bookmark insertion

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.