Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Havok crashes when dynamically invalidating collider components (Case 1420910)

Discussion in 'Physics for ECS' started by Lukas_Kastern, Apr 18, 2022.

  1. Lukas_Kastern

    Lukas_Kastern

    Joined:
    Aug 31, 2018
    Posts:
    97
    Hey,

    I recently started noticing quite a few crashes related to Havok. After investigating it a bit I managed to narrow it down to a new feature I added. This feature sets physics colliders to default(null) when a certain condition is met.

    I thought this would be fine since the PhysicsCollider.Value field itself has a comment next to it that states 'null is allowed'. But apparently setting it to null while a dynamic body intersects/collides with it will cause a crash.

    This crash only happens when using the Havok backend, Unity Physics works fine.
    Another workaround is to use a collider with a zero collision filter instead of setting it to default.

    I attached a repro project and one of my many crash dumps to the case.
     
  2. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    93
    I will forward this issue to the Havok team, thanks for posting.
     
    Lukas_Kastern likes this.
  3. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    93
    Looks like you forgot to attach the project to your post.
     
    Last edited: Apr 23, 2022
    Lukas_Kastern likes this.
  4. Lukas_Kastern

    Lukas_Kastern

    Joined:
    Aug 31, 2018
    Posts:
    97
    Huh, maybe I pressed the submit button too quickly lol.
    Anyways here is the project. I added another scene called 'FreezeScene' for another Havok-related bug that I didn't get to report yet. That one causes the executable to freeze when a dynamic body that uses a completely flat ConvexHull collides with another shape.
     

    Attached Files:

    JMPM-UNITY likes this.
  5. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    93
    Hi, @Lukas_Kastern.
    After opening HavokCrash.zip we can only reproduce the FreezeScene scene using the Havok engine.
    Regarding the CrashScene nothing crashes on our machine, the PhysicsShape simply goes on and off due to the output from the sin() function. Let us know again how do you get to that crash.
     
  6. Lukas_Kastern

    Lukas_Kastern

    Joined:
    Aug 31, 2018
    Posts:
    97
    Once you go in-game while having the CrashScene open you should be able to spawn a cube by pressing space. Once this cube intersects with the static shape it should crash.
    But I just noticed that when you have burst enabled an exception is thrown which makes the crash not happen. Once you disable burst you should be able to reproduce the crash tho.
     
    JMPM-UNITY likes this.
  7. JMPM-UNITY

    JMPM-UNITY

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    93
    We could successfully reproduce this bug after disabling burst, mind the difference
     
    Last edited: Apr 26, 2022
    Lukas_Kastern likes this.
  8. MarcGFJ

    MarcGFJ

    Joined:
    May 16, 2019
    Posts:
    24
    It seems we have the same problem here. In our Unity 2021.3.5f1 project Havok is crashing too, 9 calls below `HP_SyncWorldIn`. The disassembly view from the dump looks the same as this thread's reproduction project, with `rdx==0` trying to read location 0xC.

    The situation is quite fuzzier as we don't have such a minimal project, but we basically have a bunch of destroyed rubble that we are respawning, which might involve setting colliders to null as well. Initially we were investigating a performance issue where a rigidbody was randomly spinning out of control, but after simplifying the scene a bit we found this crash instead.

    It's a bit strange because I already tested the scenario of setting all rigidbodies' colliders to `null` before `HP_SyncWorldIn` is called (restoring them after) but apart from error printing that did not cause a crash.
     
    Last edited: Dec 7, 2022
    JMPM-UNITY likes this.