Avoid async scope lockup
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu từ reproducer async_scope, test2 và test3 được cung cấp, đồng thời so sánh ba trường hợp scheduling trong khi theo dõi việc hủy và quá trình hoàn tất scope. Tái hiện assertion của destructor, xác định lý do các trường hợp 2 và 3 vẫn chưa hoàn tất sau request_stop(), và xác minh rằng hành vi hủy dự kiến hoàn tất mà không có assertion.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
exec::task<void> test(asio::io_context &ioContext)
{
asio::steady_timer timer(ioContext);
timer.expires_after(std::chrono::seconds(10));
auto [error] = co_await timer.async_wait(asio::as_tuple(exec::asio::use_sender));
}
exec::task<void> test2(exec::async_scope& scope, asio::io_context &ioContext)
{
#if 1
co_await exec::reschedule_coroutine_on(stdexec::inline_scheduler{});
co_await scope.nest(test(ioContext));
#elif 0
co_await stdexec::on(stdexec::inline_scheduler{}, scope.nest(test(ioContext)));
#elif 0
co_await scope.nest(stdexec::on(stdexec::inline_scheduler{}, test(ioContext)));
#endif
}
exec::task<void> test3(exec::async_scope& scope, asio::io_context &ioContext)
{
co_await test2(scope, ioContext);
}
asio::io_context ioContext;
MyThread recvThread;
std::optional<exec::async_scope> asyncScope;
asyncScope.emplace();
exec::static_thread_pool ctx{1};
asio::executor_work_guard<asio::io_context::executor_type> workGuard(
asio::make_work_guard(ioContext));
recvThread.start([&]
{
ioContext.run();
printf("test\n");
}, "client_network_thread");
exec::start_detached(stdexec::starts_on(MainThreadScheduler(), test3(*asyncScope, ioContext)));
Scheduler::getSingleton()->run(GetTicks());
sleep(5);
workGuard.reset();
asyncScope->request_stop();
recvThread.join();
asyncScope.emplace();
What I am attempting to do is to wrap an async function in an async scope t make it cancellable.
In this example the MainThreadScheduler only schedules one initial time so it is expected that it will never fully finish the test3 task.
However I would still like to successfully cancel it. In the test2 function the first case works as expected. Both case 2 and 3 assert inside the asyncScope destructor since the work isn't considered finished. It wasn't fully clear to me why the work isn't considered finished in these cases. Especially in case 2.
- Ngôn ngữ chính
- C++
- Star
- 2.4k
- Fork
- 270
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 37
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/stdexec
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 66/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
Tất cả issue của NVIDIA/stdexec
Issue tương tự
-
ai_reviewed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ydb-platform/ydb#53869 · 3 bình luận ·
-
bug cert blocker needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
project-chip/connectedhomeip#74373 ·
-
[request] tracy/0.14.1 Đang mởupstream update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conan-io/conan-center-index#31035 ·
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
vllm-project/vllm-ascend#17329 ·