Search Unity

Bug Strange errors possiblty related to the particle system

Discussion in 'General Graphics' started by Gladyon, Nov 14, 2020.

  1. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    We have some strange errors which seem to be linked to the particle systems.
    We have about 200 gameObjects with emitters, I hope that it's not that which is causing the problem, because in the end we'll need much more than that.

    Here are the errors we have:
    Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!

    Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak

    Assertion failed: Assertion failed on expression: 'p >= m_Blocks[blockIndex].ptr && p < m_Blocks[blockIndex].ptr + m_BlockSize'

    Assertion failed on expression: 'all(sheetIndexNormalized >= 0.0f) && all(sheetIndexNormalized <= 1.0f)'


    In order to produce the first 3 errors, we just have to add a particle system on a one of our prefab, and set its emission rate to 200.
    The first 2 happen a lot more often than the third one.
    We can also let it to 10, and activate the cast and receive shadows features.
    In both cases the first 3 errors do happen.

    The last one happen only (along with the first error) when we use a texture sheet animation.

    These errors happen in the editor or in standalone.
    The editor and the standalone version ultimately crashes when there are too many of these errors.
    The errors are accumulating much faster in standalone than in the editor.


    We are using Unity 2017.4.25f1, and the problem is still there with Unity 2017.4.40f1.
    We cannot go for Unity 2018 or later because of the fact that the game is widely released and the networking code is quite old and would probably not survive going for a more recent Unity version.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,295
    Hi
    Could you please file a bug report?
     
    richardkettlewell likes this.
  3. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Also, it’s worth mentioning that we are not releasing any more patches for 2017.4, so we could only fix this in 2018 and newer.
     
    karl_jones likes this.
  4. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    I doubt that a bug report would help.
    We cannot reproduce the problem on an empty project, and we cannot provide the project (anyway, thousands of assets and more than 150k line of code wouldn't really help).
    In addition, as I said we cannot switch to Unity 2018 or newer, so we're not hoping for a fix from Unity (if it is a Unity bug, which isn't proven at this point).

    But you could help us by providing some insights about these 2 assertions:

    Assertion failed on expression: 'p >= m_Blocks[blockIndex].ptr && p < m_Blocks[blockIndex].ptr + m_BlockSize'
    Assertion failed on expression: 'all(sheetIndexNormalized >= 0.0f) && all(sheetIndexNormalized <= 1.0f)'

    If you could tell us in what situation these can happen it may help us isolate the problem.
    With some luck we can disable some part of the particle system (or something else) and it will prevent the problem from coming back.
    I'm pretty sure that the second one is about the 'Texture Sheet Animation' feature of the particle system, but that would help us to have a bit more information about the situations in which this assertion (and the other) can be triggered.
     
  5. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    You’re correct about the second one - it means the texture sheet anim frame has gone outside the valid range of frames (eg 5 frames, trying to use frame 7, for example) it shouldn’t be possible of course - it’s some kind of Unity bug.

    As for the first, that’s our memory manager complaining that something bad has happened. Some kind of memory corruption. Probably the cause of the texture sheet error, and also a sign of an engine bug.

    I’ve little idea how you’d try to work around these issues as a user, other than to try and isolate the faulty particle system (it seems to me that most likely a particle system using texture animation is indeed to blame)
     
    karl_jones likes this.
  6. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    Thanks for your reply.

    The particle system with the sheet animation is not to blame unfortunately.
    I have removed the particle systems and replaced them with default ones, and the error still happen from time to time (a lot less often, presumably because the default emission rate is very low).

    We also observed that the behaviour is quite different between a fast computer and a slow one (knowing that the scene is slow with both computers).
    It looks to me as being a multi-threading issue in the particle system, which could probably explain the memory corruption and the fact that computers with different clocks and core numbers don't produce the same results.
     
  7. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    We have finally found out the root of the problem.

    Each particle system we have is on a child of a parent gameObject.
    This parent also has another child, which has a light on it.
    The light has its halo activated.

    The problem was there: the halo.
    If we remove the halo, then it works perfectly fine for hours, when it was spawning errors about every second and crashed in less than 30s.
    I do not know if it is linked to the particle system or if it is the halo which is causing havoc in the memory and the particle system was only an innocent victim.

    Anyway, I wanted you to know about the halo which seem to be having some trouble.
     
    richardkettlewell and karl_jones like this.