Using Async Physics Tick create data race with other components from game thread

Hello everyone!

My project is a physics-based racing game that must provide stable physics across all players (asynchronous multiplayer, replays are sync’d through a server).

Unsatisfied with the default variable physics ticking on event tick, I used this plugin:

That I built for Unreal 5.3.2.

As you can see in plugin source there is nothing really exotic nor complicated in it, it just exposes the async physics API of the engine to blueprint scripting.

In my pawn, I fully separated physics logic from cosmetic logic in a dedicated method:


This method 100% uses async physics API (exposed by the plugin), and never uses variables controlled by game thread.

On my pawn i have a few niagara systems, ribbons mostly (I mention it because their ticking group seem to cause most of the trouble, see log below).
There is however some data that is written from physics thread, and read in Game Thread. But there is no semaphore mechanisms in blueprint :smiley:

The issue is:
Sometimes (every 20 to 80 seconds approx., random), the game hangs and have a 50% chance to crash. If not crashing, it resumes after a few seconds.

Crash logs almost always indicate several data races.
Razorback2.log (250.3 KB)

Another one that is not data race that happen from time to time. No Data race, but still an issue of threading:
Razorback22.log (455.1 KB)

In order to debug this, I have a few questions:

  1. How can i enable explicit call stack naming (instead of “Unkown Function” in order to locate both threads that race against each other ?

  2. Does anyone has any epxerience with implementing async physics in UE 5.3 ? Any issue like this ?

  3. Is there a way for me to gatekeep access to some variable that I in deed share among both thread. I do think the issue is because of this, but I did not find how to do semaphores in blueprints - pbbly bc blueprints are absolutely not fitted for this kind of stuff lol.

  4. And lastly, I could move my whole physics in a 100% C++ script (since it is isolated in one blueprint, it will not be too hard). But i still need some shared data, such as elapsed time or simulation effects to drive some visuals. How is it usually done in C++? I am used to do it in C#, but it seems odd to me that i would be the only one with this kind of issue using async physics tick.

tl;dr: UE5.3 Async physics tick data race with others : Should i move my async physics to C++ ? If so, anyone has good resource on this topic ?