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

coroutine generator cannot be moved or composed. #1789

Open
jsong785 opened this issue Aug 15, 2023 · 1 comment · May be fixed by #2354
Open

coroutine generator cannot be moved or composed. #1789

jsong785 opened this issue Aug 15, 2023 · 1 comment · May be fixed by #2354
Assignees

Comments

@jsong785
Copy link

jsong785 commented Aug 15, 2023

I am just learning this framework and cpp20; excuse me if this is a known issue/problem.

It seems like there may be an issue in seastar::coroutine::experimental::generator; where both the move constructor and assignment operator do not update the promise object's generator.

Obvious things like this seem to fail. It seems like it is fixed with a couple of lines of changes to the generator class.

auto gen = create_generator(...);
auto gen_moved = std::move(gen);

// usage of gen_moved creates error

However, I seem to get a crash on/off here no matter what. Perhaps my knowledge of coroutines is faulty.

auto gen1 = create1(...);
auto gen2 = create2(..., std::move(gen1));
auto gen3 = create3(..., std::move(gen2));
auto gen4 = create2(..., std::move(gen3));

// start using gen4, which will start gen 1/2/3 upstream.
@tchaikov
Copy link
Contributor

@jsong785 thank you for your bug report! this is not a known issue, AFAICT. actually, i never tried to move the generator. will give it a try later on.

@tchaikov tchaikov self-assigned this Aug 29, 2023
bhalevy added a commit to bhalevy/seastar that referenced this issue Jul 17, 2024
The coroutine generator move ctor, move assignment operator,
and swap override were never fully implemented.

This patch completes their implementation
and adds unit tests to cover move and swap
and also moving not-drained generator (to test
moving of their buffered value(s)).

Fixes scylladb#1789

Signed-off-by: Benny Halevy <[email protected]>
bhalevy added a commit to bhalevy/seastar that referenced this issue Jul 17, 2024
The coroutine generator move ctor, move assignment operator,
and swap override were never fully implemented.

This patch completes their implementation
and adds unit tests to cover move and swap
and also moving not-drained generator (to test
moving of their buffered value(s)).

Fixes scylladb#1789

Signed-off-by: Benny Halevy <[email protected]>
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

Successfully merging a pull request may close this issue.

2 participants