exec::start_now: request_stop() on the storage does not reach the senders
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
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
- 平均マージ
- 2日 32分
- マージ済み PR(30日)
- 88
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/stdexec のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
NVIDIA/stdexec#1751 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1週間以上 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
NVIDIA/stdexec#2402 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
enhancement third-party
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pocoproject/poco#5656 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
documentation enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
QuantStack/git2cpp#203 ·
メンテナーはふだん 1 日以内に返信