Git Product home page Git Product logo

Comments (6)

hniksic avatar hniksic commented on September 28, 2024

Hi, can you provide a more detailed description of the issue you are having?

In particular, I'm not sure how the drop could be initiated from any thread. SendRc is supposed to exist in one thread, unless you explicitly move it to a different thread, in which case you are responsible to park it before moving and unpark it after.

from sendable.

hniksic avatar hniksic commented on September 28, 2024

@gbemiga-viewserver Any news on this?

from sendable.

gbemiga-viewserver avatar gbemiga-viewserver commented on September 28, 2024

from sendable.

hniksic avatar hniksic commented on September 28, 2024

@gbemiga-viewserver Thanks for the update. It's not a problem to leave it open for a while longer.

from sendable.

GmeduoyeClaymore avatar GmeduoyeClaymore commented on September 28, 2024

Thank you for so patiently leaving this issue open. I have created a PR to demonstrate my issue. I am quite open to this not being an issue at all and in fact, being an unsupported usage pattern. The issue that I have with my application is that I cannot guarantee that the thread that invokes the drop has ownership of the SendRc so I get really strange failures as in the test I have added. Can you tell me what to do or how to think :) To prevent issues like this. Thanks.

#4

from sendable.

hniksic avatar hniksic commented on September 28, 2024

Thanks for providing a concrete example. Indeed, this usage pattern is not only unsupported, but SendRc is actually designed to detect and prevent it. You're required to move all the SendRc's to another thread, and your code doesn't do that, it r1 and r2 to two different threads.

It doesn't matter that the only thing that happens to r1 is dropping it. If such a drop were allowed, it would allow a data race (undefined behavior in Rust) simply by cloning or dropping r2 in the first thread. This is because clone() and drop() modify the reference count without explicit synchronization.

Note that even if SendRc used atomic reference counts (which would eliminate much of its performance benefits), panic would still be possible if the "wrong" thread happened to be the one to reach refcount==0.

from sendable.

Related Issues (3)

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.