Search Issue Tracker
Fixed in 5.5.0
Votes
4
Found in
5.3.5f1
Issue ID
810451
Regression
No
[Android][iOS] Thread.MemoryBarrier() does not prevent instruction reordering with mono backend
Reproduction steps
--------------------------
1) Open attached project "MemoryBarrierRepro"
2) Build scene "testScene" for Android/iOS
3) Run on a device
4) Observe the log
--- You will see results of user's test in this format: "wrong value 42323173 ,correct: 42323177 ,previous: 42323176"
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Editor crashes on StoredGraphicsBuffer::GetGfxBufferID when VFX Graph property is modified during Play Mode and Application.targetFrameRate is used to limit FPS
- Crash on NVAPI_Thunk when changing Player resolution while HDR display is used and Direct3D12 is set as the graphics API
- Only one out of multiple cameras is shown in the Play Mode while HDR display is used and Direct3D12 is set as the graphics API
- The "Paste Component as New" option is incorrectly displayed as active despite the action being prohibited
- "TLS Allocator ALLOC_TEMP_TLS" errors are thrown when unsuccessfully importing an FBX file
Douvantzis
Jul 07, 2016 22:43
A similar bug has been filed for Mono 4. However in Mono 4 the test does not fail when Memory Barriers are used. The bug in that case is reproduced when a Volatile field is used instead of Memory Barrier.
You can read the discussion here:
http://mono.1490590.n4.nabble.com/Volatile-fields-don-t-enforce-acquire-release-semantics-like-Volatile-Read-and-Volatile-Write-td4668111.html
Douvantzis
Jul 06, 2016 09:46
Volatile fields have also a related problem in Unity' Mono run time for Android and iOS. They don't have acquire and release semantics: https://msdn.microsoft.com/en-us/library/aa645755.aspx
It's as if no memory fences are applied.
The submitted test project fails if instead of using MemoryBarriers, a volatile field is used.