You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that there are problems with some systems (mostly more modern AMD systems) where in some cases std::random_device will result in an exception. Currently this causes applications to be unusable.
Referencing this issue in libsass, I made a quick patch for solving this problem.
Since the current state of branches seems to be undergoing some refactoring/updating to newer version, and i have no idea where to PR to at this point, here is a diff based on the sonobus main repo.
Sonobus works as expected using this patch, where before it would crash on start.
diff --git a/deps/aoo/lib/src/client.cpp b/deps/aoo/lib/src/client.cpp
index f02e5ce6..0ec74259 100644
--- a/deps/aoo/lib/src/client.cpp
+++ b/deps/aoo/lib/src/client.cpp
@@ -170,11 +170,16 @@ aoo::net::client::client(void *udpsocket, aoo_sendfn fn, int port)
sendbuffer_.setup(65536);
recvbuffer_.setup(65536);
- // generate random token
- std::random_device randdev;
- std::default_random_engine reng(randdev());
- std::uniform_int_distribution<int64_t> uniform_dist(1); // minimum of 1, max of maxint
- token_ = uniform_dist(reng);
+ try {
+ std::random_device randdev;
+ std::default_random_engine reng(randdev());
+ std::uniform_int_distribution<int64_t> uniform_dist(1); // minimum of 1, max of maxint
+ token_ = uniform_dist(reng);
+ }
+ // On certain system this can throw since either
+ // underlying hardware or software can be buggy.
+ // https://github.com/sass/libsass/issues/3151
+ catch (std::exception&) {}
}
void aoonet_client_free(aoonet_client *client){
diff --git a/deps/aoo/lib/src/source.cpp b/deps/aoo/lib/src/source.cpp
index 82f02088..c769d0f2 100644
--- a/deps/aoo/lib/src/source.cpp
+++ b/deps/aoo/lib/src/source.cpp
@@ -899,10 +899,18 @@ int32_t source::set_format(aoo_format &f){
}
int32_t source::make_salt(){
- thread_local std::random_device dev;
- thread_local std::mt19937 mt(dev());
- std::uniform_int_distribution<int32_t> dist;
- return dist(mt);
+ try {
+ thread_local std::random_device dev;
+ thread_local std::mt19937 mt(dev());
+ std::uniform_int_distribution<int32_t> dist;
+ return dist(mt);
+
+ }
+ // On certain system this can throw since either
+ // underlying hardware or software can be buggy.
+ // https://github.com/sass/libsass/issues/3151
+ catch (std::exception&) {}
+ return 42;
}
int32_t source::set_userformat(void * ptr, int32_t size){
The text was updated successfully, but these errors were encountered:
It seems that there are problems with some systems (mostly more modern AMD systems) where in some cases std::random_device will result in an exception. Currently this causes applications to be unusable.
Referencing this issue in libsass, I made a quick patch for solving this problem.
Since the current state of branches seems to be undergoing some refactoring/updating to newer version, and i have no idea where to PR to at this point, here is a diff based on the sonobus main repo.
Sonobus works as expected using this patch, where before it would crash on start.
The text was updated successfully, but these errors were encountered: