Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actor state can't be reset in case of any exception in the user code. #762

Closed
mtaghavi2005 opened this issue Oct 5, 2021 · 3 comments · Fixed by #789
Closed

Actor state can't be reset in case of any exception in the user code. #762

mtaghavi2005 opened this issue Oct 5, 2021 · 3 comments · Fixed by #789
Assignees
Labels
breaking-change kind/bug Something isn't working
Milestone

Comments

@mtaghavi2005
Copy link

Expected Behavior

According to what is documented in the source code (Actor.cs), in time of execution of an actor method, if user code throws any exception, all the state changes in the state manager should not be saved.

internal Task OnInvokeFailedAsync()

image

Actual Behavior

Actor saves all state changes, regardless of whether there is any exception in the user code or not.

Steps to Reproduce the Problem

After calling the following Actor Method, the state will be saved in the actor state storage.

        public async Task DoSomeTask()
        {
            await StateManager.SetStateAsync("TestState", "Some Value");

            throw new Exception("Something went wrong!");
        }
@mtaghavi2005 mtaghavi2005 added the kind/bug Something isn't working label Oct 5, 2021
@fabistb
Copy link

fabistb commented Oct 6, 2021

@msfussell can you please add this issue to our project?

@rynowak
Copy link
Collaborator

rynowak commented Oct 19, 2021

@halspang can you investigate this?

@halspang halspang added this to the v1.6 milestone Nov 22, 2021
@halspang
Copy link
Contributor

Took a look into this and was able to repro it. I'll work on a fix.

halspang added a commit to halspang/dotnet-sdk that referenced this issue Jan 13, 2022
When an actor call fails, it is imperative that the state is reset.
In the remoting path, we were catching the exception and returning
an error response instead of propagating the exception. Without this,
the error path was never triggered. This allowed for state from
failed requests to persist on subsequent requests.

dapr#762

Signed-off-by: Hal Spang <halspang@microsoft.com>
halspang added a commit that referenced this issue Jan 13, 2022
When an actor call fails, it is imperative that the state is reset.
In the remoting path, we were catching the exception and returning
an error response instead of propagating the exception. Without this,
the error path was never triggered. This allowed for state from
failed requests to persist on subsequent requests.

#762

Signed-off-by: Hal Spang <halspang@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants