Coder Social home page Coder Social logo

Comments (9)

philliphoff avatar philliphoff commented on July 20, 2024 2

. Specifically, this internal actor code should check for an error result indicating that the workflow wasn't found and then return a nil response rather than an error response.
Alternatively, we could update durabletask-go to export and check for a well-known ErrInstanceNotFound error, and then have the Dapr runtime return this value instead of nil if we determine that a queried workflow doesn't exist.

@cgillum Of the two, I'd vote for the first option, returning nil instead of an error. IMO, "non existence" isn't (necessarily) an error. Or rather, whether it's an error or not should be determined by the calling application and not the object store. Returning an error value, even a very specific "not found" value, will tend to get treated as a generic error on the other side of gRPC boundary. In the case of .NET, that will be an exception, which are tedious to handle as well as impact performance. (I wish the gRPC libraries had the option of treating invocations more more like raw HTTP invocations where the result could be observed before any action is taken.)

from dapr.

yaron2 avatar yaron2 commented on July 20, 2024 1

Transferred issue to the runtime repo.

cc @cgillum

from dapr.

philliphoff avatar philliphoff commented on July 20, 2024

As best I can tell, it looks like an issue with the workflow component in the Dapr runtime or the Durable Task Go SDK (where it doesn't treat "not found" as a non-error error, and just passes back the original error instead of nil) which then gets passed up to the Durable Task SDK on top of which the Dapr .NET Workflow SDK are built. I'd file an issue in dapr/dapr.

from dapr.

cgillum avatar cgillum commented on July 20, 2024

Is the expectation that no gRPC error is observed or is the expectation that the gRPC error makes it easy to distinguish between "not found" and other errors, for example, by using appropriate status codes (NotFound instead of Unknown)?

from dapr.

arturotrenard avatar arturotrenard commented on July 20, 2024

well reviewing the existing implementation in the sdk it seems to me that they expect a null in c# and nil in go
Screenshot from 2024-06-19 20-00-14
Screenshot from 2024-06-19 20-05-53

from dapr.

cgillum avatar cgillum commented on July 20, 2024

My question was whether you the application developer have an expectation on the ideal behavior. But I assume based on the screenshots you shared that you're okay with the behavior that the SDKs were designed for.

Looking at the durabletask-go code, it seems the gRPC API implementation is consistent with the SDKs, as shown here: https://github.com/microsoft/durabletask-go/blob/60e42f2bb25034de2b20201a3139f5fcc159200e/backend/executor.go#L268-L278. In other words, it expects a nil response from the backend implementation (defined by Dapr in this case) to indicate that an instance doesn't exist, in which case it will return a "doesn't exist" response to the gRPC client, which the SDKs are designed to handle gracefully.

I think the simplest way to fix this is to update the Dapr runtime code here:

res, err := abe.actorRuntime.Call(ctx, req)
elapsed := diag.ElapsedSince(start)
if err != nil {
// failed request to GET workflow Information, record count and latency metrics.
diag.DefaultWorkflowMonitoring.WorkflowOperationEvent(ctx, diag.GetWorkflow, diag.StatusFailed, elapsed)
return nil, err
}
. Specifically, this internal actor code should check for an error result indicating that the workflow wasn't found and then return a nil response rather than an error response.

Alternatively, we could update durabletask-go to export and check for a well-known ErrInstanceNotFound error, and then have the Dapr runtime return this value instead of nil if we determine that a queried workflow doesn't exist.

from dapr.

amzhang avatar amzhang commented on July 20, 2024

+1

from dapr.

arturotrenard avatar arturotrenard commented on July 20, 2024

If correct, that's fine with me

from dapr.

arturotrenard avatar arturotrenard commented on July 20, 2024

any update guys??

from dapr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.