Giter VIP home page Giter VIP logo

Comments (6)

ashtum avatar ashtum commented on May 18, 2024 1

Yeah, Chris usually doesn't respond to the issues, but he reads them. We should track the changes in the repository to see if it gets fixed or not.

from beast.

ashtum avatar ashtum commented on May 18, 2024

The issue is associated with creating a work_guard from a strand<any_io_executor>. It attempts to utilize on_work_started() and on_work_finished() functions, which are not defined for asio::any_io_executor. This results in a compile error in websocket::stream<tcp>::async_write because it attempts to create a work_guard from the associated executor.
It can be reproduced with the following code as well: https://godbolt.org/z/nvr9jjnrY

#include <boost/asio.hpp>

namespace asio = boost::asio;

int main()
{
    asio::io_context ioc;
    asio::any_io_executor exec = ioc.get_executor();
    auto strand = asio::make_strand(exec);
    auto wg = asio::make_work_guard(strand);
}

I will further investigate to determine whether we can address this in Beast or if it is a bug in Asio.

from beast.

redboltz avatar redboltz commented on May 18, 2024

I'm not 100% sure but passing strand.get_inner_executor() to make_work_guard could solve the issue ?

#include <boost/asio.hpp>

namespace asio = boost::asio;

int main()
{
    asio::io_context ioc;
    asio::any_io_executor exec = ioc.get_executor();
    auto strand = asio::make_strand(exec);
    auto wg = asio::make_work_guard(strand.get_inner_executor());
}

https://godbolt.org/z/jv1zEW7ET

from beast.

ashtum avatar ashtum commented on May 18, 2024

I'm not 100% sure but passing strand.get_inner_executor() to make_work_guard could solve the issue ?

This will generate a work guard for any_io_executor instead of strand<any_io_executor>. Calling get_executor on this work guard will return an instance of any_io_executor.
Although I believe it will function correctly in this case, as we don't retrieve the executor from the work guard, I am seeking a cleaner solution or addressing this in Asio.

from beast.

ashtum avatar ashtum commented on May 18, 2024

I've raised an issue in Asio for this; let's see what will be the response. chriskohlhoff/asio#1394

from beast.

redboltz avatar redboltz commented on May 18, 2024

chriskohlhoff/asio#1394 still no response. It seems that there are a lot of uncommented issues in the project.
I think that this issue is often appered using C++20 coroutine with strand in the real world.
See https://godbolt.org/z/7EnWa3Es1
If there were no update until the next release, I would appliciate if you implemented some workaround on the beast side .

from beast.

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.