Giter Site home page Giter Site logo

Comments (2)

nelsoncvjr-stone avatar nelsoncvjr-stone commented on July 1, 2024 1

Thanks for your attention @madelson!

from distributedlock.

madelson avatar madelson commented on July 1, 2024

@nelsoncvjr-stone thanks for the detailed report!

return new LockHandlerToken(handler, handler.HandleLostToken);

By accessing HandleLostToken you're forcing the library to start proactively tracking the state of the underlying connection. However, it's not obvious from your code that you actually need this. I would suggest either removing the wrapper class or making the wrapper class access the token lazily so that you only pay this price when you are actually going to use the HandleLostToken in your caller.

I would like to know if this behavior is by design/expected by lib or not?

So far, I have not made "avoid UnobservedTaskException" a design constraint for this library. There are cases where the library spins off background tasks that could fail under normal conditions such as monitoring connection drops which might get interrupted by the application's desire to release the lock (and therefore close the connection).

In many cases, I've endeavored to minimize the overhead of thrown exceptions via an internal TryAwait() method. However, this issue revealed to me that TryAwait() was not properly observing the exception so it would still get reported as unobserved.

I've pushed a fix for that issue to the release-2.4 branch; it will be included in the next release of the library.

That said, I have not audited the entire library for other cases where UnobservedTaskException might fire spuriously; I'd welcome issues that identify more scenarios though.

from distributedlock.

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.