Skip to content

unexpected event type of type 'OrchestratorStarted' #1095

@DDAndyChen

Description

@DDAndyChen

Getting some errors in the log stream when testing the Counter example, in fact, all of my durable entities is not running for this same error. what might be the issue?

2024-05-19T12:41:21Z   [Error]   TaskEntityDispatcher-23269d6ab59b427f8acb4adf3ecd0dac-0: Unhandled exception with work item '@counter@myCounter': DurableTask.Core.Exceptions.EntitySchedulerException: The entity with instanceId '@counter@myCounter' received an unexpected event type of type 'OrchestratorStarted'. This is not a valid entity message. This is a framework-internal error, please report this issue in the GitHub repo: 'https://github.com/Azure/durabletask/'
   at DurableTask.Core.TaskEntityDispatcher.DetermineWork(OrchestrationRuntimeState runtimeState, SchedulerState& schedulerState, Work& batch) in /_/src/DurableTask.Core/TaskEntityDispatcher.cs:line 568
   at DurableTask.Core.TaskEntityDispatcher.OnProcessWorkItemAsync(TaskOrchestrationWorkItem workItem) in /_/src/DurableTask.Core/TaskEntityDispatcher.cs:line 241
   at DurableTask.Core.TaskEntityDispatcher.OnProcessWorkItemAsync(TaskOrchestrationWorkItem workItem) in /_/src/DurableTask.Core/TaskEntityDispatcher.cs:line 377
   at DurableTask.Core.TaskEntityDispatcher.OnProcessWorkItemSessionAsync(TaskOrchestrationWorkItem workItem) in /_/src/DurableTask.Core/TaskEntityDispatcher.cs:line 122
   at DurableTask.Core.WorkItemDispatcher`1.ProcessWorkItemAsync(WorkItemDispatcherContext context, Object workItemObj) in /_/src/DurableTask.Core/WorkItemDispatcher.cs:line 373

Here is my code

internal class Tests
{
    [Function("AddFromQueue")]
    public static Task Run(
        [HttpTrigger(AuthorizationLevel.Admin, "post", Route = "api/tests/test")]
        HttpRequest req,
        [DurableClient] DurableTaskClient client)
    {
        // Entity operation input comes from the queue message content.
        var entityId = new EntityInstanceId(nameof(Counter), "myCounter");
        int amount = 32;
        return client.Entities.SignalEntityAsync(entityId, "Add", amount);
    }
}

public class Counter : TaskEntity<int>
{
    private readonly ILogger logger;

    public Counter(ILogger<Counter> logger)
    {
        this.logger = logger;
    }

    public void Add(int amount) => this.State += amount;

    public void Reset() => this.State = 0;

    public int Get() => this.State;

    [Function(nameof(Counter))]
    public static Task RunEntityStaticAsync([EntityTrigger] TaskEntityDispatcher dispatcher)
    {
        return dispatcher.DispatchAsync<Counter>();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions