Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash if fiber sleeps in catch block (Windows only) #293

Open
vgaraschuk opened this issue Mar 22, 2022 · 0 comments
Open

Crash if fiber sleeps in catch block (Windows only) #293

vgaraschuk opened this issue Mar 22, 2022 · 0 comments

Comments

@vgaraschuk
Copy link

If anything makes a fiber sleep in the 'catch' block (not by thread sleeping, but switching to another fiber), then, when it wakes up, it crashes on trying to switch back to the 'try' block (at least, according to the call stack). The issue is not reproducible on Linux.
The following code crashes when built and run on Windows (tested with boost 1.67 and boost 1.76):

#include "boost/fiber/all.hpp"

void func()
{
    try
    {
        throw std::logic_error("error");
    }
    catch (...)
    {
        boost::this_fiber::sleep_for(std::chrono::milliseconds(100));
    }
}

int main()
{
    boost::fibers::fiber f1(func);
    boost::fibers::fiber f2(func);

    f1.join();
    f2.join();

    return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant