Update from 2018.4.32f1 to 2021.3.14f1 crashes SIGSEGV UI::PrepareOutput

After updating Unity from 2018.4.32f1 to 2021.3.14f1, we encountered a new type of crashes. Later, we updated to 2021.3.21f1, but it did not resolve them. There are multiple variations of stack trace but they all have this part in common:

Stack trace variant 1:

null pointer dereference: SIGSEGV  0x0000000000000004
#00 pc 0x5410f8 libunity.so (dynamic_array<UI::smile:epthSortEntry, 0ul>::grow()) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#01 pc 0x53e93c libunity.so (UI::PrepareOutput(GfxDevice&, UI::Batches&, unsigned int, unsigned int, UI::AdditionalCanvasShaderChannels, unsigned char)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#02 pc 0x53eadc libunity.so (UI::PrepareOutput(GfxDevice&, UI::Batches&, unsigned int, unsigned int, UI::AdditionalCanvasShaderChannels, unsigned char)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#03 pc 0x20d834 libunity.so (JobQueue::Exec(JobInfo*, long long, int, bool)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#04 pc 0x20daec libunity.so (JobQueue::Steal(JobGroup*, JobInfo*, long long, int, bool, bool)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#05 pc 0x20dc58 libunity.so (JobQueue::ExecuteJobFromQueue(bool, bool&)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#06 pc 0x20de98 libunity.so (JobQueue::ProcessJobs(JobQueue::ThreadInfo*, void*)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#07 pc 0x1149d44 libunity.so (__emutls_register_common [emutls.c:249]) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#08 pc 0x11a703c libunity.so (__emutls_register_common [emutls.c:249]) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#09 pc 0x20d1c8 libunity.so (JobQueue::WorkLoop(void*)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#10 pc 0x2b4d84 libunity.so (Thread::RunThreadWrapper(void*)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#11 pc 0xe2630a libunity.so (__emutls_register_common [emutls.c:249]) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#12 pc 0x11aed9c libunity.so (__emutls_register_common [emutls.c:249]) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#13 pc 0x530ffc libc.so (BuildId: 544bc6c8e3556e98efbc4406b97f6a3e)
#14 pc 0xc37f4 libc.so (BuildId: 544bc6c8e3556e98efbc4406b97f6a3e)
#15 pc 0x5d0c4 libc.so (BuildId: 544bc6c8e3556e98efbc4406b97f6a3e)
#16 pc 0xc3720 libc.so (BuildId: 544bc6c8e3556e98efbc4406b97f6a3e)
#17 pc 0x2b4ca8 libunity.so (CurrentThreadIsMainThread()) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)

Stack trace variant 2:

null pointer dereference: SIGSEGV  0x0000000000000000
#00 pc 0x53fba8 libunity.so (UI::PrepareOutput(GfxDevice&, UI::Batches&, unsigned int, unsigned int, UI::AdditionalCanvasShaderChannels, unsigned char)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#01 pc 0x20d824 libunity.so (JobQueue::Exec(JobInfo*, long long, int, bool)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#02 pc 0x20daec libunity.so (JobQueue::Steal(JobGroup*, JobInfo*, long long, int, bool, bool)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#03 pc 0x20dc58 libunity.so (JobQueue::ExecuteJobFromQueue(bool, bool&)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#04 pc 0x20de98 libunity.so (JobQueue::ProcessJobs(JobQueue::ThreadInfo*, void*)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#05 pc 0x1149d44 libunity.so (__emutls_register_common [emutls.c:249]) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#06 pc 0x11a703c libunity.so (__emutls_register_common [emutls.c:249]) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#07 pc 0x20d1c8 libunity.so (JobQueue::WorkLoop(void*)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#08 pc 0x2b4d84 libunity.so (Thread::RunThreadWrapper(void*)) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#09 pc 0xe2630a libunity.so (__emutls_register_common [emutls.c:249]) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#10 pc 0x11aed9c libunity.so (__emutls_register_common [emutls.c:249]) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)
#11 pc 0x527ffc libc.so (BuildId: 7841d31efc11481579e4cb75ccbcdb4f)
#12 pc 0xbe888 libc.so (BuildId: 7841d31efc11481579e4cb75ccbcdb4f)
#13 pc 0x5b370 libc.so (BuildId: 7841d31efc11481579e4cb75ccbcdb4f)
#14 pc 0xbe7b4 libc.so (BuildId: 7841d31efc11481579e4cb75ccbcdb4f)
#15 pc 0x2b4ca8 libunity.so (CurrentThreadIsMainThread()) (BuildId: e40fbfaec3bd5f5bdc8dd091f6c2a801b6fa202e)

These are some of the most common crashes overall, but on the Samsung Galaxy A53 5G, they result in a crash rate of 7%. We had no luck trying to reproduce it though.

Do these stack traces make sense? I rebuilt symbols on the same machine and Unity version and got the same results using the Android Logcat Stacktrace Utility. It’s confusing that I can’t find any information about a problem that affects so many players.

Is this a known Unity problem? Perhaps even one that has already been resolved (2021 is old). If so, which version should we try?

The first error looks like it might be an a memory problem. It seems to be trying to enlarge an array. Maybe try reducing memory use if that’s possible.

This might be the case. The average RAM free value is lower for these crashes compared to non-fatal errors. This applies to other crashes as well. We’ll try to optimize memory usage and reporting. Thank you!