mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
On Fedora 28, creating an instance of `std::random_device` opens a file descriptor for `/dev/urandom` (observed via `strace`). By declaring static thread-local instances of `std::random_device`, these descriptors will be open (barring optimization by the compiler) for the entire duration of the Scylla process's life. However, the `std::random_device` instance is only necessary for initializing the `RandomNumberEngine` for generating salts. With this change, the file-descriptor is closed immediately after the engine is initialized. I considered generalizing this pattern of initialization into a function, but with only two uses (and simple ones) I think this would only obscure things. Signed-off-by: Jesse Haber-Kucharsky <jhaberku@scylladb.com> Tests: unit (release) Message-Id: <f1b985d99f66e5e64d714fd0f087e235b71557d2.1536697368.git.jhaberku@scylladb.com>