Search Unity

Resolved How to debug JobHandles?

Discussion in 'Entity Component System' started by Guedez, Nov 7, 2020.

  1. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    827
    I am getting this
    The previously scheduled job ECSGrassSystem:PackPositionJob reads from the Unity.Collections.NativeList`1[System.UInt16] PackPositionJob.source. You must call JobHandle.Complete() on the job ECSGrassSystem:PackPositionJob, before you can deallocate the Unity.Collections.NativeList`1[System.UInt16] safely
    which by all means should be impossible, as I explicitly JobHandle.Complete() all instances of said job I can think of. Surely I might have missed one somewhere somehow, but I don't know how or how to figure out which. How does one debug such an issue?
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    Without code we can't really help
    That error really should tell you everything you need.
     
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,264
    Look for all instances of PackPositionJob and immediately complete their job handles. Then undo those changes one by one until the error shows up again.
     
    MNNoxMortem likes this.
  4. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    827
    There is no tool that keeps track of where each job was scheduled and if they are not finished yet? Because, well, it will take a lot of time to make one myself.

    I really can't figure out how and why it wouldn't be complete if I had explicitly called
    .complete()
    .

    (I ended up figuring out the issue in the middle of making a giant post explaining how it works, one of my methods was missing a boolean optional parameter to ensure that all jobs get finished this frame regardless of how long they take so they can be disposed of)