[SOLVED] Crash on PS4 Platform when AsyncLoad is activated

XaviBlay

New member
Hi,
We need to load our BehaviorTrees in asyncronous way due performance needs but it's crashing on PS4. The callstack is not always the same so we cannot identify wich is the cause of the crash (Several images of the crahes are attached to this thread). Instantiate only one BT seems to mitigate the issue, sometimes the application does not crash.

We tryed JSON and Binary serialization but it crashes on both.

Our thoughts are that Main thread is trying to acess to the same Memory Position as the Loading thread of the current BT... But we are not sure about it.

As additional info:
· We cannot reproduce it on Standalone Builds.
· It's mitigated on PS5 systems (Tested with retrocompatibility)

We are using the BehaviorDesigner source code and unity version 2020.3.1f1. IL2CPP is mandatory on PS4 system.

Thanks!
Xavi.
 

Attachments

  • BD_Report.zip
    369.4 KB · Views: 3
Are you able to step through the code to determine the line that is causing the exception?
 
Unfortunately, the callstacks show that the crashes does not occurs always at the same function, so we cannot determine a line where the exception is thrown.
 
Unfortunately that makes it really hard to debug. I'm assuming the PS4 supports background threads? If there's anyway for me to reproduce it on a PC build I can take a closer look
 
Yes, PS4 supports separated threads. All the crashes seems to happen when a System.Reflection function is called (I detected FieldInfo.GetValue, FieldInfo.SetValue and MemberInfo.Name). I'll will investigate if there is any known issue on Playstation systems (or IL2CPP) when Reflection methods are called from a separated thread and let you know what I found.
If I can't find anything I'll try to reproduce it on a Standalone Build.
 
Last edited:
Hi again,
after some investigation I've found that the issue happens because the thread stack is getting out of memory. So I think that the only thing we can do might be simplifying our BTs by reducing serialized fields and tasks.

For example we've noticed that all the serialized variables of a ScriptabelObject referenced in a task are serialized inside the task too (We've noticed that by printing which fields are deserialized while BT is Loaded).

Edit: We'll try to increase the stack size using the Thread constructor parameter. I'll letyou know if it solves the issue.

Edit2: We can confirm that the issue is fixed increasing the stack size of the thread to 512KB. It would be usefull if the size of the threads created to Load the BTs were exposed by the API.

Thanks!
 
Last edited:
Top