Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Havok infinite loop when Use Job Threads disabled (with fix)

Discussion in 'Physics for ECS' started by tertle, Feb 23, 2023.

  1. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,626
    Turning off Job Threads for some testing
    upload_2023-2-24_10-25-51.png
    When I have Havok Physics selected
    upload_2023-2-24_10-26-21.png
    causes my editor to lock up and go into an infinite loop.

    Switching back to Unity Physics and turning off Job Threads works fine.

    upload_2023-2-24_10-28-12.png

    I'm pretty sure your issue is HavokSimulation.cs:163
    Code (CSharp):
    1. private int NumberOfThreads => JobsUtility.JobWorkerCount - 1;
    this needs to be
    Code (CSharp):
    1. private int NumberOfThreads => math.max(1, JobsUtility.JobWorkerCount - 1);
    Alternatively this also appears like it would fail on a 2 core machine, are you sure it's not meant to be +1 like Unity.Physics uses.
    Broadphase.cs:162
    Code (CSharp):
    1. // +1 for main thread
    2. int threadCount = JobsUtility.JobWorkerCount + 1;
    Seems odd to intentionally leave an empty worker thread?
     
    Last edited: Feb 24, 2023
  2. JosepMariaPujol

    JosepMariaPujol

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    89
    Hey, @tertle I will forward this issue to the right people. Thanks for reporting!
     
  3. JosepMariaPujol

    JosepMariaPujol

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    89
    I inform you we fixed this error internally, good catch!
     
    daniel-holz and JesOb like this.
  4. JosepMariaPujol

    JosepMariaPujol

    Unity Technologies

    Joined:
    Jun 16, 2021
    Posts:
    89
    This bug has been fixed and will be released with the next available package update.
     
    tertle likes this.