Coder Social home page Coder Social logo

Comments (9)

TalAloni avatar TalAloni commented on July 20, 2024 1

A class instance of SMB2Client is not thread safe and access to it from two different threads should be synchronized.

from smblibrary.

TalAloni avatar TalAloni commented on July 20, 2024 1

But the exception from SMBLibrary that I reported crashes the entire app (I assume that it crashes ThreadPool or ThreadPool's thread). Maybe it's a bug in .NET runtime, idk...

Any unhandled exception in a thread started by SMBLibrary has the potential to crash the entire app. That's how .NET is designed and that's why there shouldn't be any unhandled exception in a thread started by SMBLibrary.
There was a bug in v1.5.1 that was fixed in v1.5.2, if you can show there is another issue - it will be addressed as well.

from smblibrary.

TalAloni avatar TalAloni commented on July 20, 2024

Hi,

  1. Please check if this happens with v1.5.2
  2. The client is not thread-safe.

from smblibrary.

TalAloni avatar TalAloni commented on July 20, 2024

Also, obviously there should be no unhandled exceptions on background threads, if there is such a case - it is obviously a bug that should be addressed and exceptions should be handled locally. I don't feel there is a need to handle exceptions globally as an additional precaution.

from smblibrary.

rodion-m avatar rodion-m commented on July 20, 2024

Thanks a lot for a quick response! Ok, we'll update and try to reproduce this error after that.

About thread safety - do you mean that a class instance of SmbClient2 is not thread safe? (In this case it's enough to use it as scoped dependency). Or entire parallel access to SMBLibrary is not safe? (In this case dependency lifetime doesn't take an effect and we should globally synchronize access to SmbClient2).

from smblibrary.

rodion-m avatar rodion-m commented on July 20, 2024

Also, obviously there should be no unhandled exceptions on background threads, if there is such a case - it is obviously a bug that should be addressed and exceptions should be handled locally. I don't feel there is a need to handle exceptions globally as an additional precaution.

But the exception from SMBLibrary that I reported crashes the entire app (I assume that it crashes ThreadPool or ThreadPool's thread). Maybe it's a bug in .NET runtime, idk... We use .NET 6.
I think you can easily reproduce this behavior by yourself by manually throwing any exception inside the callback: SMBLibrary.Client.SMB2Client.OnClientSocketReceive(IAsyncResult)

PS: On our side SMBLibrary methods are called from ASP.NET Core controller's handlers, so these handlers catch all exceptions and then return 500, they can't crash the app.

from smblibrary.

rodion-m avatar rodion-m commented on July 20, 2024

There was a bug in v1.5.1 that was fixed in v1.5.2

Thanks a lot! We'll check it and report you about the results.

from smblibrary.

TalAloni avatar TalAloni commented on July 20, 2024

Please open a new issue if you experience an issue with the latest version.

from smblibrary.

rodion-m avatar rodion-m commented on July 20, 2024

We couldn't reproduce this error after an updating to 1.5.3. Thanks a lot for your help!

from smblibrary.

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.