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

[Workflows] Returning an entity that was added to an EF context causes the activity to retry. #1216

Open
clintsinger opened this issue Dec 20, 2023 · 4 comments
Assignees
Labels
kind/bug Something isn't working P0

Comments

@clintsinger
Copy link

In what area(s)?

/area runtime

/area operator

/area placement

/area docs

/area test-and-release

What version of Dapr?

1.12 (.NET SDK)

Expected Behavior

The developer should be able to return any type of entity as part of a workflow activity payload.

Actual Behavior

When using .NET SDK to execute a workflow activity, if the payload contains an entity that was added to an Entity Framework DbContext, the activity will fail silently and then the workflow system will retry it. There is no obvious indication that the activity has failed at all other than the retry.

Steps to Reproduce the Problem

  1. Create an activity that contains a DbContext
  2. Create an entity and add it to a table in the context and save
  3. Return the same entity in the activity payload
  4. Observe that the activity is retried a minute later

NOTE: The issue only occurs when the entity is added to the context via the Add method. Querying an entity and returning works as expected.

Release Note

RELEASE NOTE:

@clintsinger clintsinger added the kind/bug Something isn't working label Dec 20, 2023
@clintsinger clintsinger changed the title [Workflows] Returning an entity that was added to an EF context causes the activity retry. [Workflows] Returning an entity that was added to an EF context causes the activity to retry. Dec 20, 2023
@mukundansundar mukundansundar transferred this issue from dapr/dapr Dec 22, 2023
@philliphoff
Copy link
Collaborator

@clintsinger Which version of the Dapr .NET SDK are you using, and do you happen to have a small repro project?

Is the DbContext disposed when the activity completes (before the entity is returned)? I'm curious whether the context's entity tracking is perhaps interfering with serialization of the data on return of the activity. If run inside a debugger, are any exceptions being thrown (perhaps not by the activity itself, but elsewhere in the SDK post-activity)?

@clintsinger
Copy link
Author

I am using 1.12.0.

I don't have a ready to go repro project but I'm pretty sure it would be pretty easy to put into any project the team has. Just return an entity that is added to the DbContext. I expect the DbContext is being cleaned up at the time of the return.

I didn't notice any errors at all. The activity would just repeat itself.

@cgillum
Copy link
Contributor

cgillum commented Sep 12, 2024

Marking as P0 since it causes the activity to continually repeat itself, and because it seems like it may be easy to run into this problem. More investigation is needed to determine if this is an SDK issue or if there's a larger runtime issue.

@siri-varma
Copy link

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working P0
Projects
Status: Backlog
Development

No branches or pull requests

4 participants