Skip to content

Crash with stdexec::task (probably premature coro destruction) #2041

@mika-fischer

Description

@mika-fischer

We are seeing this crash relatively reliably on MSVC 17.14.13 (cl 19.44.35215).

I suspect that the task coro handle is destroyed before final_suspend or something along those lines.

I had hoped that the changes in #2038 relating to coro destruction would have fixed this, but unfortunately, it still happens even with those changes.

TEST_CASE("stdexec.task.task_crash_repro") {
    auto task = [] -> stdexec::task<void> { co_return; };
    auto pool = exec::static_thread_pool(1);
    auto scope = stdexec::counting_scope();
    for (int i = 0; i < 1000; ++i) {
        stdexec::spawn(stdexec::starts_on(pool.get_scheduler(), task())
                           | stdexec::upon_error([](auto) noexcept {}),
                       scope.get_token());
    }
    stdexec::sync_wait(scope.join());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions