Giter Site home page Giter Site logo

Comments (4)

mxinden avatar mxinden commented on May 30, 2024

Thank you for your debugging work and the elaborate explanation.

I am still confused by one thing. Sorry in case I am missing something. It is rather late in my day.

Once the connection task called on_behaviour_event on the ConnectionHandler, it will go ahead and poll the ConnectionHandler, given that both is running in a loop.

loop {
match futures::future::select(
command_receiver.next(),
poll_fn(|cx| Pin::new(&mut connection).poll(cx)),
)
.await
{
Either::Left((Some(command), _)) => match command {
Command::NotifyHandler(event) => connection.on_behaviour_event(event),

Shouldn't this make the fix in #4961 obsolete?

from rust-libp2p.

thomaseizinger avatar thomaseizinger commented on May 30, 2024

Good catch @mxinden! I think you are right and #4961 should indeed not be necessary.

from rust-libp2p.

stormshield-frb avatar stormshield-frb commented on May 30, 2024

Yes indeed. I had not succeeded in finding where the Handler::poll was called and in what context, thanks for that @mxinden. If it is the only place, I also think that the bug can not happen with the current implementation.

As for #4961 not being necessary, indeed, since there does not seem to be a case where the bug could happen, it might not be required to do it. However, we should be careful in the future because, since the contract of the poll method is broken (a function returning Poll::Pending must also ensure that the current task is scheduled to be awoken when progress can be made), if a future change is made to this part of the codebase (like the change that caused #4860, for example), the bug could then be revealed.

I'll let you decide what you prefer, and I will understand either way 😊

from rust-libp2p.

thomaseizinger avatar thomaseizinger commented on May 30, 2024

I'll close this as not necessary. If you want, we can merge a documentation update that explains this @stormshield-frb ! Thank you for the work! :)

from rust-libp2p.

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.