exec::start_now: request_stop() on the storage does not reach the senders
維護者通常 1 天內回覆
已經有一個關聯 PR 被合併了。
- #2417 來自 @Nas01010101 —— 已合併
評估
研究方向
Read include/exec/async_scope.hpp around __nest_receiver::get_env and include/exec/start_now.hpp around __storage and __receiver to trace which stop token reaches the sender. Then inspect test/exec/async_scope/test_start_now.cpp and add coverage for calling storage.request_stop(); done means the test observes the sender stop instead of run. Pull request #2417 is already open for this issue.
由索引模型根據 Issue 內容生成。
描述
exec::start_now returns a storage object with request_stop() and get_token(), but a stop request on that object never reaches the started senders. request_stop() returns true and the senders keep running.
Reproducer
#include <stdexec/execution.hpp>
#include <exec/async_scope.hpp>
#include <exec/start_now.hpp>
#include <cstdio>
namespace ex = stdexec;
int main() {
ex::run_loop loop;
exec::async_scope scope;
bool ran = false;
bool stopped = false;
auto storage = exec::start_now(
scope,
ex::schedule(loop.get_scheduler())
| ex::then([&]() noexcept { ran = true; })
| ex::upon_stopped([&]() noexcept { stopped = true; }));
bool accepted = storage.request_stop();
loop.finish();
loop.run();
ex::sync_wait(scope.on_empty());
std::printf("request_stop=%d ran=%d stopped=%d\n", accepted, ran, stopped);
}
Expected: request_stop=1 ran=0 stopped=1
Actual: request_stop=1 ran=1 stopped=0
Tested on main at 081ab7fc with clang 21.1.8 and g++ 14. Calling scope.request_stop() instead of storage.request_stop() does stop the sender, so the run loop's scheduler honors stop requests in this program.
Cause
__storage puts its own token in the environment of __receiver, and then wraps each sender with __scope.nest(...). __nest_receiver::get_env in include/exec/async_scope.hpp overrides get_stop_token with the scope's token, so the sender only ever sees the scope's token. The token from __storage::get_token() compares unequal to the one the sender reads.
test/exec/async_scope/test_start_now.cpp has no test that calls request_stop().
- 主要語言
- C++
- 星號
- 2.5k
- 分支
- 284
- 平均合併
- 1 天 21 小時
- 30 天內合併 PR
- 92
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
NVIDIA/stdexec 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
The sender attributes of `then` and `upon_xxx` incorrectly answer queries for `get_completion_scheduler` and `get_completion_domain`可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 4/5 1-2 天 新手友好度 45/100
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 25/100
維護者通常 1 天內回覆
-
難度 4/5 一週以上 新手友好度 18/100
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 18/100
維護者通常 1 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 77/100
arvidn/libtorrent#9149 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
Niko1221/Strata#5560 · 2 則留言 ·
維護者通常 4 天內回覆
-
NVIDIA windows
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
要トリアージ 辞書
難度 1/5 1-3 小時 新手友好度 86/100
yksr-melt/Meltype#1625 · 1 個 reaction ·
維護者通常 1 天內回覆