Unsafe Send
and Sync
implementations
#154
Labels
bevy adapter
pertaining to bevy/naia adapter crates
bug
needs fixing
naia socket
pertaining to naia_socket crates
naia
pertaining to naia crates
The library marks a lot of types that are explicitly
!Send
and!Sync
(meaning they can't be shared between threads) withunsafe impl Send
andunsafe impl Sync
. Considering that these types are actively used in the context of Bevy systems and wrapped into resources accessed withRes
/ResMut
, it's very likely to lead to UB.Unsafe types in question:
https://github.com/search?q=repo%3Anaia-lib%2Fnaia+%22unsafe+impl%22&type=code
We should remove all the
unsafe impl Send
andunsafe impl Sync
occurrences, even if it means that resources can no longer be accessed from different threads. Bevy supportsNonSend
, and I'd argue that limiting systems to run only on the main thread is a better compromise than causing UB.The text was updated successfully, but these errors were encountered: