Hi Sebastian,
Following your request, I ran the process tonight and generated the view:
[Image Removed]I also attached it to the post in case it is not readable on the forum, …
I never used that view. Quite handy indeed. On the very left, we can see the pattern I tried to described. There are 30 workers and 29 seems idle. The last one being one of our own tasks which is waiting for the next upcoming tick (which requires the task completion from the physics).
Now, trying to answer your questions :
In general, why are you waiting in your task for the game thread?
Such waits are usually an anti-pattern.
--> We have the ability to load data from an external format and stream it directly at runtime. For this, the loading is broken in small pieces and sections are executed synchronously (in game thread) and other in asynchronous tasks. The history behind is that in the beginining everything occured in game thread but we are offloading to tasks so we have better and smoother frame rate. When a step requires the game thread, the async task will wait for it to pick it up before continuing. We are using semaphore to avoid data races.
If you need to schedule further work on the game thread you can do that as a follow up task or just set it up through task dependencies/prerequisites from the start.
--> I guess we might but that would require more refactoring and possibly lead to code being less readable (at least for us).
If you task is a long running one that does work every frame that it gets from the game thread then the task system is likely the wrong tool. You could schedule a task each frame instead of having a blocking task that wait.
--> This is not what we do. We have a lengthy task that may take multiple /many frames to occur which, at some point, requires game thread action.
In these cases you’ve seen, is there now task executing the FPhysicsSolverProcessPushDataTask at all?
--> As I said, I looked at all the workers and I cannot see that task being executed (or pending). It feels like the scheduler just dropped it which would obviously be an issue. I am now running a version of the engine that I built locally. If there is any more inspection I can do, let me know.
Last note, this is happening in editor. When this lock has been seen, we were creating assets (loading from other standard and saving as Unreal native assets). So far, this has never been observed in runtime / game mode.
Thanks,
[Attachment Removed]