Errors in the creation of std::random_device
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
- 45/100
Hướng nghiên cứu
Bắt đầu với include/boost/fiber/detail/spinlock_ttas.hpp tại phần khởi tạo random-device được liên kết và src/algo/work_stealing.cpp quanh dòng 68, sau đó chạy các bài kiểm thử Boost.Fiber bị ảnh hưởng để tái hiện crash. Truy vết cách các lỗi khởi tạo lan truyền và xác minh rằng các lỗi từ std::random_device không còn gây ra các crash kiểm thử không được xử lý.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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?
- Ngôn ngữ chính
- C++
- Star
- 512
- Fork
- 124
- Merge trung bình
- 23 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 boostorg/fiber
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
-
Boost\libs\fiber\test failed to build due to error C2039 with /std:c++latest option on WindowsĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 42/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Tất cả issue của boostorg/fiber
Issue tương tự
-
bug priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
chipsalliance/verible#2644 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
grafana/pyroscope-dotnet#470 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation P5 XS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
open-astro/AlpacaBridge#1848 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DiskANN AnnIterator returns unconverted IP distances after the graph walk runs out of candidatesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
zilliztech/knowhere#1933 ·
Maintainer thường phản hồi trong vòng 1 ngày