Code Monkey home page Code Monkey logo

Comments (8)

microrama avatar microrama commented on June 4, 2024 1

Thanks @cgillum! This certainly is a bit more complicated but we will work with you for any approaches we have and of course test locally before and after hand as well.

from durabletask-mssql.

microrama avatar microrama commented on June 4, 2024

@cgillum - Would it be OK for me and Misha to attempt to fix this issue and propose a solution?
Btw, Misha is my manager and we work together and are trying to use DTF for workflows.

from durabletask-mssql.

cgillum avatar cgillum commented on June 4, 2024

@microrama yes, if you’re able to find and submit a solution for this, we would be more than happy to accept it. It would be great to have a fix for this issue.

from durabletask-mssql.

microrama avatar microrama commented on June 4, 2024

This is what's happening:
DurableTask.SqlServer.SqlUtils.WithRetry() gets called by SqlOrchestrationService.LockNextTaskOrchestrationWorkItemAsync() method. This has the DBCommand passed to it.
The first run when the network is out, we get the SqlException which is checked by IsTransient() method and is logged in the method as traceHelper.TransientDatabaseFailure(). This is the first DurableTask.SqlServer error that we see as a warning.
Now, while the retry loop is being executed, the second time around it appears we get an System.InvalidOperationException that is not evaluated as transient by the IsTransient() method.
This exception is thrown back to the calling DurableTask.Core caller and that is logged as an error.
Subsequent calls work great because the network blip worked out.

POC:
With a simple console application, we were able to reproduce the InvalidOperationException by forcibly closing the SqlConnection before calling the ExecuteReaderAsync.
It was hard to reproduce the first transient SqlException in the VM machine where we develop.

Bottomline:
The first error is a SqlException error and is considered a transient but by the second attempt, it turns into a InvalidOperationException since the SqlConnection is closed at this point.

Fix:
Pass the DBCommand to the WithRetry() method and let the method check the DBCommand connection state and open if needed before attempting executor again. If there is a SqlException opening the connection again, existing logic will retry or return fatal error back.

Next Steps:
We will try out the code in our Sandbox environment and monitor.

from durabletask-mssql.

microrama avatar microrama commented on June 4, 2024

The code change was tested in our cert environment and it appears the issue is now fixed. We will still see the Warning but the Error is gone since we check for SqlConnection State and open the connection on the command object as needed.
This was tested in the CERT environment where on an average there is a network blip once or twice a day.
Attaching screenshots:
image

Next steps - I will create a PR for this issue for your review. Thx @cgillum!

from durabletask-mssql.

microrama avatar microrama commented on June 4, 2024

@cgillum - FYI. I created the PR few days back. Please review when you have time.
#221

from durabletask-mssql.

microrama avatar microrama commented on June 4, 2024

@cgillum - Greatly appreciate any help with reviewing the PR :-)
#221

from durabletask-mssql.

cgillum avatar cgillum commented on June 4, 2024

@microrama taking a look now - thanks!

from durabletask-mssql.

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.