Severe crashes related to Particle System on Android Vulkan backend

I’m still having the same issue as described Unity 2022.2.1f1 iOS Build crash (possibly with ParticleSystemGeometryJob?) and Unity Issue Tracker - Crash in TransformParticleMesh

I wonder which features in ParticleSystem it could be related or it’s just unusable in Vulkan. I need to decide whether I stick with Vulkan or switch to GLES

Here are some more detailed information below:

The unity version I tried is 2022.3.14 & 2022.3.51, seems only reproducible in Android release mode with Vulkan backend. When I switch to GLES backend, it’s not happening so often.

The strack trace:

1
libunity.so
pc 0000000000d30a80
void TransformParticleMeshAnimatedUVs<false>(ParticleMeshData const&, int, ParticleSystemTempData const&, ParticleSystemParticlesTempData const&, ColorRGBA32, ParticleSystemRendererData const&, ParticleSystemModules const&, math::affineX const&, math::float3x3 const&, ParticleSystemParticles const&, unsigned long, unsigned char**, float**) [arm64-v8a]
2
libunity.so
pc 0000000000d28acc
void DrawMeshParticles<(ParticleSystemRenderSpace)3>(ParticleSystemTempMeshData const&, ParticleSystemTempData const&, ParticleSystemParticles const&, ParticleSystemParticlesTempData const&, ParticleSystemRendererData const&, ParticleSystemModules const&, float*, void*) [arm64-v8a]
3
libunity.so
pc 0000000000d1eeb0
ParticleSystemGeometryJob::ScheduleJobs(BaseRenderer**, unsigned long, RendererCullingCallbackProperties const&) [arm64-v8a]
4
libunity.so
pc 00000000002e49f4
prepare_job_for_schedule(ujob_control_t*, JobsCallbackFunctions&, void*, WorkStealingRange*, unsigned int, unsigned int, ujob_handle_t const*, int, unsigned char, ujob_job_t*, unsigned int*, bool) [arm64-v8a]
5
libunity.so
pc 00000000002e4e60
job_completed(ujob_control_t*, ujob_job_t*, ujob_lane_t*, ujob_handle_t) [arm64-v8a]
6
libunity.so
pc 00000000002e55e4
ujob_combine_dependencies(ujob_control_t*, ujob_handle_t const*, int) [arm64-v8a]
7
libunity.so
pc 00000000003aa06c
RingBufferMemoryFileData::Read(VFS::FileSize, unsigned long, void*) const [arm64-v8a]
8
/apex/com.android.runtime/lib64/bionic/libc.so
pc 00000000000b8ff8
(mtx_timedlock+60) [arm64-v8a]
9
/apex/com.android.runtime/lib64/bionic/libc.so
pc 0000000000052768
[arm64-v8a]

There is also another Vulkan validation issue which happens a lot, I think it’s also related to the particle system:

1
/data/app/~~Q0vRgXCbatK04jJM_zQWcQ==/lib/arm64/libVkLayer_khronos_validation.so
pc 0000000000f0348c
ParticleGeomWrite(ParticleSortData const*, unsigned long, bool, unsigned char**, unsigned char*, int, int, math::float3x3 const&, math::floatNx3 const&, math::floatNx3 const&, math::floatNx3 const&, math::floatNx3 const&, float vector[4] const&, float*&, math::floatNx3 const*, ColorRGBA32 const*, math::floatNx2 const*, math::floatNx4 const*, math::floatNx3 const&, float vector[4] const&, int vector[4] const*, int)+1024 [arm64-v8a]
2
/data/app/~~Q0vRgXCbatK04jJM_zQWcQ==/lib/arm64/libVkLayer_khronos_validation.so
pc 0000000000fa7fe8
void GenerateParticleGeometry<(ParticleSystemRenderMode)0, false, false, (ParticleSystemRenderSpace)0>(float*, ParticleSystemTempData const&, ParticleSystemRendererData const&, ParticleSystemModules const&, ParticleSystemParticles const&, ParticleSystemParticlesTempData const&)+2020 [arm64-v8a]
3
/data/app/~~Q0vRgXCbatK04jJM_zQWcQ==/lib/arm64/libVkLayer_khronos_validation.so
pc 0000000000bdb208
ParticleGeomWrite(ParticleSortData const*, unsigned long, bool, unsigned char**, unsigned char*, int, int, math::float3x3 const&, math::floatNx3 const&, math::floatNx3 const&, math::floatNx3 const&, math::floatNx3 const&, float vector[4] const&, float*&, math::floatNx3 const*, ColorRGBA32 const*, math::floatNx2 const*, math::floatNx4 const*, math::floatNx3 const&, float vector[4] const&, int vector[4] const*, int)+516 [arm64-v8a]
4
libunity.so
pc 0000000000a617e0
GfxDeviceVKBase::DrawBuffersInternal(VkBuffer_T*, unsigned long, unsigned int, VkBuffer_T* const*, unsigned int const*, unsigned long const*, int, DrawBuffersRange const*, int, VertexDeclaration*, unsigned int, int) [arm64-v8a]
5
libunity.so
pc 0000000000a6b9d4
GfxDeviceVKBase::DrawBufferRangesPlatform(GfxBuffer*, unsigned int, GfxBuffer* const*, unsigned int const*, int, DrawBuffersRange const*, int, VertexDeclaration*, unsigned long, int) [arm64-v8a]
6
libunity.so
pc 00000000009492e4
SinglePassStereoSupportExt::DrawBuffersStereo(GfxBuffer*, unsigned int, GfxBuffer* const*, unsigned int const*, int, DrawBuffersRange const*, int, VertexDeclaration*, unsigned long) [arm64-v8a]
7
libunity.so
pc 0000000000a6153c
GfxDeviceVKBase::DrawBuffers(GfxBuffer*, unsigned int, GfxBuffer* const*, unsigned int const*, int, DrawBuffersRange const*, int, VertexDeclaration*) [arm64-v8a]
8
libunity.so
pc 00000000009a4748
GfxDevice::DrawSharedGeometryJobs(DynamicVBOBuffer const&, unsigned int, DynamicVBOBuffer const&, unsigned int, GeometryJobFence, DrawBuffersRange const*, unsigned long, VertexDeclaration*) [arm64-v8a]
9
libunity.so
pc 0000000000bb82fc
GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&) [arm64-v8a]
10
libunity.so
pc 0000000000bb1588
GfxDeviceWorker::RunExt(ThreadedStreamBuffer&) [arm64-v8a]
11
libunity.so
pc 0000000000bb12d0
GfxDeviceWorker::RunGfxDeviceWorker(void*) [arm64-v8a]
12
libunity.so
pc 000000000039f504
Thread::RunThreadWrapper(void*) [arm64-v8a]
13
/apex/com.android.runtime/lib64/bionic/libc.so
pc 00000000000b8ff8
(mtx_timedlock+60) [arm64-v8a]
14
/apex/com.android.runtime/lib64/bionic/libc.so
pc 0000000000052768
[arm64-v8a]

And lastly Vulkan validation layer also reports the following info but I couldn’t get the stack trace yet

  I  VUID-vkFreeMemory-memory-00677(ERROR / SPEC): msgNum: 1214025378 - Validation Error: [ VUID-vkFreeMemory-memory-00677 ] | MessageID = 0x485c8ea2 | vkFreeMemory():  can't be called on VkDeviceMemory 0xea18cd0000017942[] that is currently in use by VkBuffer 0x8d617f0000017940[]. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkFreeMemory-memory-00677)

It seems ParticleSystem is very unstable on Vulkan backend

Hello @kikopanda, I’m sad to here that you experienced this crash again. Would you be able to share a project where this issue occurs, along with the device and version used ? That would greatly help us track down the bug.
Thank you!

1 Like

Hi, Ludovic, Thanks a lot for helping.
It will be quite complex to provide simple reproducible project, this could be related to multiple effects we are using in the project. I’ll try to narrow it down for simple test case. For now, I tried to remove trail renderer with zero MinVertexDistance, seems helping a little bit, but mesh emitter in ParticleSystem seems also causing some crashes. If you can provide some hints about features that could be related to these crash logs, it could also be very helpful.
I also wonder whether it’s related to using particle system jobs, is it possible to disable jobs for ParticleSystem

From the past crashes that happened with a similar callstack, the culprits were mesh emitters that were destroyed during a frame. Maybe that would help you narrow down the project.
It is indeed related to Particle System Geometry Jobs, but it is not possible to disable that.

1 Like

Do you mean mesh emitters being created and then destroyed in one frame or multiple emitters being destroyed in the same frame ?