Bug: should_originate_on_cancel does not cancel certain awaiters or duplicated actions.
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
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- cpp
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
Theo dõi việc xử lý hủy thông qua impl::check_status_canceled, await_adapter::await_resume, timespan_awaiter::await_resume và signal_awaiter::await_resume. Xác minh rằng việc hủy lặp lại không khôi phục thiết lập originate-on-cancel và rằng resume_after cùng resume_on_signal tuân theo originate_on_cancel(false); thêm hoặc cập nhật coverage cho các kịch bản awaiter lặp lại và được liệt kê.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
3.0.260715.1
Summary
- #1512 introduced the setter originate_on_cancel and getter should_originate_on_cancel. The await_resume task would call originate_on_cancel (the setter) to check whether to RoOriginate the call. This is a bug, because the setter has a side effect. Its parameter defaults to true, so each call does std::exchange(m_originate_on_cancel, true): it returns the previous value, so the first check behaved correctly, and then wrote the flag back to true. Every later cancellation on that same promise originated again. A test that cancels only once passes even with the bug present.
IAsyncAction DoWork(HANDLE ready)
{
auto cancel = co_await get_cancellation_token();
cancel.originate_on_cancel(false); // "don't debug spew when I'm cancelled"
co_await resume_on_signal(ready); // If cancelled before `ready`, doesn't originate.
// The first Cancel() consumes the opt-out, re-arms the flag
co_await CleanupAsync(); // If cancelled after, then the next co_await will
// call Cancel() again, and since should_originate is true now
// it will Originate, thus causing the debug spew.
}
In addition, there is a missing scenario in the previous PR, it did not account for winrt::resume_after, winrt::resume_on_signal, and
These three awaiter resume paths also threw hresult_canceled unconditionally, so originate_on_cancel(false) had no effect on them at all: impl::check_status_canceled (reached from await_adapter::await_resume for any coroutine awaiting a WinRT async that completes Canceled), timespan_awaiter::await_resume (resume_after) and signal_awaiter::await_resume (resume_on_signal).
Reproducible example
IAsyncAction PollStatusAsync()
{
auto cancel = co_await get_cancellation_token();
cancel.enable_propagation();
cancel.originate_on_cancel(false);
while (true)
{
co_await RefreshAsync();
co_await resume_after(30s); // cancelled here -> timespan_awaiter::await_resume
} // throws hresult_canceled() -> originates
}
Expected behavior
No response
Actual behavior
No response
Additional comments
No response
- Ngôn ngữ chính
- C++
- Star
- 1.9k
- Fork
- 281
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
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 microsoft/cppwinrt
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
base_macros.h disables warnings without push/pop, leaking them into consumer translation units Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 20/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
Tất cả issue của microsoft/cppwinrt
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 ·