Search Unity

Profiler: Invalid blocks order for per-thread data detected

Discussion in 'Editor & General Support' started by Peter77, Jul 18, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    I'm using Unity 2018.4.4f1 to build and profile a Win64 Player (project attached Case 1108597).

    While profiling, Unity outputs (I guess every frame) the following warning to the Console window:
    What is the warning telling me and how can I fix it?

    Furthermore, sometimes Unity outputs this warning while profiling:
    How can I fix this?
     
  2. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    508
    Hi Peter!

    The warning is generally a result of too much data is being transferred through the connection between player and editor. When a connection is not capable to handle all generated data by profiler we drop data and that might cause both warnings. You can fix it by making sure the connection can handle 50MB/s or dumping data to file.

    However I recall "There might be missing profiler data - invalid blocks order for per-thread data detected." warning was also occurring in when profiling a project with high JobSystem activity and enabling/disabling profiler quickly - this was a bug which we fixed in 2019 afaik. If this case sounds similar when we need to backport the fix.
     
    Peter77 likes this.
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    Hi Alexey, thanks for your help!

    How would I go to make sure the connection can handle 50MB/s? I'm running the Player and Editor on the same PC, it's not like I'm connected to a device over WIFI or so.

    It also did work without these warnings in earlier Unity versions. For example, I didn't see this warning in Unity 2017.

    I don't have any JobSystem related user code in the project and I also didn't toggle the profiler quickly. Perhaps it's a different issue.
     
  4. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    508
    Loopback connection should be enough to maintain much higher transfer rater. I assume the problem is different then, more likely Editor is just not processing the data fast enough.In this case the workaround would be still to dump data to the file. I'll try to reproduce the issue with the project you've provided.

    This is strange - we've changed profiler backend in Unity 2017.3. There were no major changes since then.
     
    Peter77 likes this.
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    Cool, thank you!

    If you test this in 2018.4.4, you'll also encounter another Profiler issue, where it claims Profiler.Begin/End calls do not match. This is caused in
    ManagedUpdate.cs
    by this code:
    Code (CSharp):
    1. #if WPROFILE
    2.     _UpdateSampler.Begin(current as UnityEngine.Object);
    3. #endif
    4.  
    5.     current.ManagedUpdate();
    6.  
    7. #if WPROFILE
    8.     _UpdateSampler.End();
    9. #endif
    Removing the
    current as UnityEngine.Object
    argument gets rid of the error.

    I had the project a long time on 2017.4 and really didn't see this issue afair. I've updated to 2018.4 recently and then it started to occur.
     
    Last edited: Jul 22, 2019
  6. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    508
    Thank you for the report! We are backporting the fix to 2018.4
     
    Peter77 likes this.