Errors in the creation of std::random_device
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Comienza con include/boost/fiber/detail/spinlock_ttas.hpp en la construcción de random-device enlazada y con src/algo/work_stealing.cpp alrededor de la línea 68; después ejecuta las pruebas afectadas de Boost.Fiber que reproducen el fallo. Rastrea cómo se propagan los errores de inicialización y verifica que los errores de std::random_device ya no provoquen fallos de prueba no controlados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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?
- Lenguaje dominante
- C++
- Estrellas
- 511
- Forks
- 123
- Merge medio
- 25 d 23 h
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de boostorg/fiber
-
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
-
Boost\libs\fiber\test failed to build due to error C2039 with /std:c++latest option on WindowsAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 42/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Todos los issues de boostorg/fiber
Issues similares
-
Status: Needs confirmation Status: Needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
bug-unconfirmed
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
A-combat P-low S-ready-to-start task
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
bug intrinsic medium priority rt_lib
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día