Errors in the creation of std::random_device
まだ誰も着手していません。
評価
調査の方向性
リンクされている random-device の構築箇所にある include/boost/fiber/detail/spinlock_ttas.hpp と、68 行目付近の src/algo/work_stealing.cpp から始め、その後、クラッシュを再現する影響を受ける Boost.Fiber テストを実行します。初期化失敗がどのように伝播するかを追跡し、std::random_device の失敗によって未処理のテストクラッシュが発生しなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
説明
Hi all,
I noticed some of our tests crashing inside Boost.Fiber. More specific, the constructor of std::random_device throws an std::runtime_error with the description random_device: rdseed failed which is not handled.
#0 in __cxxabiv1::__cxa_throw (obj=obj@entry=0x7ffc580491f0, tinfo=0x5555559e3400 <typeinfo for std::runtime_error@@GLIBCXX_3.4>, dest=0x7ffff7770fd0 <std::runtime_error::~runtime_error()>) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:78
#1 in std::__throw_runtime_error (__s=__s@entry=0x7ffff783f763 "random_device: rdseed failed") at /build/gcc/src/gcc/libstdc++-v3/src/c++11/functexcept.cc:102
#2 in std::(anonymous namespace)::__x86_rdseed () at /build/gcc/src/gcc/libstdc++-v3/src/c++11/random.cc:108
#3 in boost::fibers::detail::spinlock_ttas::lock() ()
#4 ...
Inside of Boost.Fiber, std::random_devices are constructed to seed static, thread local random number generators in the spinlock implementations as well as in the work stealing scheduler.
https://github.com/boostorg/fiber/blob/df4a190f5b92ba86395cf58b1040ed295caf9fc5/include/boost/fiber/detail/spinlock_ttas.hpp#L42
https://github.com/boostorg/fiber/blob/df4a190f5b92ba86395cf58b1040ed295caf9fc5/src/algo/work_stealing.cpp#L68
At these locations, it is assumed that the construction is successful. However, the constructor might throw an implementation-defined exception if something goes wrong.
In our case, such failures occurred using the libstdc++ released with GCC 10.1.0 on machines which support the rdseed instruction. In a situation where multiple threads are spawned and need to initialized these random number generators, the available entropy exhausted and rdseed fails often enough for std::random_device to give up.
This behavior was already reported in the GCC bugtracker and a fallback to rdrand had been added for the next (?) GCC release. This change does not guarantee, that std::random_device is constructed successfully, but it makes it more likely. So it would be great if Boost.Fiber would handle possible errors.
In the meantime, is there a good way for a user of Boost.Fiber to handle this error?
- 主要言語
- C++
- スター
- 512
- フォーク
- 124
- 平均マージ
- 23日 19時間
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/fiber のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 42/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
似ている issue
-
launch-client --save-creds creates creds/<account>/ with mode 755, not 700対応中かも @metis-sprock が今日担当しました。 オープンbacklog bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
EchoTools/nevr-runtime#1471 ·
メンテナーはふだん 1 日以内に返信
-
.NET ep:WebGPU platform:web
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/onnxruntime#33755 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
grumpycoders/pcsx-redux#2530 ·
-
A-tools P-medium S-ready-to-start studio task
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Status: Needs confirmation Status: Needs triage Type: Code Quality
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信