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

Failed assertion when giving make_exceptional_continuable() to when_seq() #50

Open
rkonklewski-am2m opened this issue Sep 2, 2022 · 1 comment

Comments

@rkonklewski-am2m
Copy link
Contributor

Hi, @Naios!

It seems I found another issue: when_seq() connection operator can't deal with ready exceptional continuables (i.e. created by make_exceptional_continuable()). It doesn't have the same problem with lazy exceptional continuables. Moreover, when_all() and when_any() operators don't have the problem at all. Neither does the chaining operator (>>).

To me this is a corner case and not a high priority. A workaround is to chain something to ready continuables before giving them to when_seq() (see Steps to Reproduce).


Commit Hash

4.2.0 release

Expected Behavior

when_seq() forwards the exception like it would for a lazy exceptional continuable.

Actual Behavior

Assertion failed: is_value(), file *redacted*\continuable\include\continuable/detail/utility/result-variant.hpp, line 167

Steps to Reproduce

auto eptr = std::make_exception_ptr(std::exception("test"));
// case 1: lazy exceptional continuable is fine
cti::when_seq(cti::async([eptr]() -> int { std::rethrow_exception(eptr); }));
// case 2: ready exceptional continuable triggers an assertion failure
cti::when_seq(cti::make_exceptional_continuable<int>(eptr));
// case 3: chaining something to a ready exceptional continuable fixes the issue
cti::when_seq(cti::make_exceptional_continuable<int>(eptr).then([](auto) {}));

Your Environment

  • OS: Windows
  • Compiler and version: MSVC 2019 v16.11.18
  • defined CONTINUABLE_WITH_UNHANDLED_EXCEPTIONS
@Naios
Copy link
Owner

Naios commented Sep 3, 2022

Thanks for your report, all chaining operations are optimized for ready continuables and probably the issue originates from there. I will take a closer look into it. when_all and when_any use a different traversal code than when_seq so it's reasaonable that these operations are not affected by this bug.

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

No branches or pull requests

2 participants