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
In my usecase I dispatch a very hug number of workflows and I recognized an increasing memory usage.
Steps to Reproduce
Create a workflow which will be dispatched very often (my test dispatches about 200 workflows per second)
After about 1 minute I stop dispatching and wait another minute to be sure that all queues are empty.
Expected Behavior
The memory usage should be nearly the same es at startup time.
Actual Behavior
The memory is higher than expected.
Analysing the heap memory shows that there are a hugh number of CancellationTokenSources.
Environment
Elsa Package Version: 3.3.2
Operating System: Windows 10
Troubleshooting Attempts
I created my own {Custom}BackgroundCommandSenderHostedService and changed the following code:
From
private async Task ReadOutputAsync(Channel<ICommand> output, CancellationToken cancellationToken)
{
await foreach (var command in output.Reader.ReadAllAsync(cancellationToken))
{
try
{
using var scope = _scopeFactory.CreateScope();
var commandSender = scope.ServiceProvider.GetRequiredService<ICommandSender>();
await commandSender.SendAsync(command, CommandStrategy.Default, cancellationToken);
}
catch (Exception e)
{
_logger.LogError(e, "An unhandled exception occured while processing the queue");
}
}
}
To
private async Task ReadOutputAsync(Channel<ICommand> output, CancellationToken cancellationToken)
{
await foreach (var command in output.Reader.ReadAllAsync(cancellationToken))
{
try
{
using var scope = _scopeFactory.CreateScope();
var commandSender = scope.ServiceProvider.GetRequiredService<ICommandSender>();
await commandSender.SendAsync(command, CommandStrategy.Default, CancellationToken.None);
}
catch (Exception e)
{
_logger.LogError(e, "An unhandled exception occured while processing the queue");
}
}
}
after that it gives this result:
Any idea whats the problem here or how to fix this?
The strange thing is that there are no instances if I try to debug it.
The BackgroundCommandSenderHostedService has 4 items inside the _output variable and if I check the UnboundedChannel inside them the _items lists are empty and I'm also not able to find a big number of AsyncOperation items. UnboundedChannel source code
The text was updated successfully, but these errors were encountered:
Description
In my usecase I dispatch a very hug number of workflows and I recognized an increasing memory usage.
Steps to Reproduce
Create a workflow which will be dispatched very often (my test dispatches about 200 workflows per second)
After about 1 minute I stop dispatching and wait another minute to be sure that all queues are empty.
Expected Behavior
The memory usage should be nearly the same es at startup time.
Actual Behavior
The memory is higher than expected.


Analysing the heap memory shows that there are a hugh number of CancellationTokenSources.
Environment
Troubleshooting Attempts
I created my own {Custom}BackgroundCommandSenderHostedService and changed the following code:
From
To
after that it gives this result:

Any idea whats the problem here or how to fix this?
The strange thing is that there are no instances if I try to debug it.
The BackgroundCommandSenderHostedService has 4 items inside the _output variable and if I check the
UnboundedChannel
inside them the _items lists are empty and I'm also not able to find a big number of AsyncOperation items.UnboundedChannel source code
The text was updated successfully, but these errors were encountered: