Skip to content

ReceiveTimeout messages not delivered after an async receive handler execution. #1185

@creepone

Description

@creepone

After execution of an async receive handler in an actor suspends the mailbox so that the ReceiveTimeout messages are not delivered, until the next message resumes the mailbox. In a following example:

public class MyActor : ReceiveActor
{
    public MyActor()
    {
        Receive<string>(async _ =>
        {
            var result = await DoSomethingAsync();
            Context.SetReceiveTimeout(TimeSpan.FromSeconds(1));
        });

        Receive<ReceiveTimeout>(_ =>
        {
            Console.Write("Timed out.");
        });
    }
}

after sending a string message to an actor initially, even though a receive timeout is configured, the ReceiveTimeout handler is never called.

Using a synchronous handler (replacing await DoSomethingAsync() with DoSomethingAsync().Result) or sending any message to Self in the async handler both seem to fix the problem.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions