Search Unity

Bug Huge amount of Leak Detection warnings inside the multiplayer sample project

Discussion in 'NetCode for ECS' started by StickyTommie, May 6, 2021.

  1. StickyTommie

    StickyTommie

    Joined:
    Oct 23, 2019
    Posts:
    13
    I downloaded the sampleproject from GitHub over at https://github.com/Unity-Technologies/multiplayer

    I didn't change anything, I just go into PlayMode, in this case NetCube, and it gives these warnings...

    upload_2021-5-6_10-11-12.png

    It is extremely variable on how many I get, sometimes I get internal allocations from age 5, sometimes it goes all the way up to 12, but almost always in blocks of 4 logs.

    Full console log for each of them is as following, in the order as the image above, put into code blocks (EDIT: apparently I couldn't enter multiple codeblocks, so screenshots it is) for easier formatting.


    Code (CSharp):
    1. Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    upload_2021-5-6_10-27-52.png

    upload_2021-5-6_10-28-3.png

    upload_2021-5-6_10-28-11.png

    upload_2021-5-6_10-28-19.png

    The constant logging of these warnings is absolutely tanking my FPS and none of the multiplayer samples can be player properly to see what they do. For example, the NetCube scene gives me the most jittery movement I have ever seen. These logs bring down the FPS to 20...

    Oh, these logs also continue displaying wether or not Leak Detection is ON or OFF.

    Is this normal? Is anyone else experiencing this?

    What can I do to solve this?
     
    Last edited: May 6, 2021
  2. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    I dun think it's normal. I also get similar thing only at the time of loading scene in my project. Seems like this warning spamming only shows up recently. Not sure whether it's recent Unity version engine bug, Entities package or Burst package bug.
     
  3. StickyTommie

    StickyTommie

    Joined:
    Oct 23, 2019
    Posts:
    13
    very strange, hopefully @timjohansson or @CMarastoni can clarify this a bit.
     
  4. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    This is a known issue caused by TempJob allocations not dealing well with fixed update systems - and the server is fixed update.

    We are looking at ways to solve it, but it requires significant changes to how TempJob allocations work in entities so I cannot say when it will be fixed.

    The workaround for now is to enable "VSync (Game view only)" in the "Free aspect" dropdown of the Game view tab in the editor.
     
    EugenyN1 and StickyTommie like this.
  5. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @timjohansson. This doesn't work for my project. The behavior of my project is quite different. It only spam warning awhile when just enter playmode then no more spam. Real Android client build also have that same warning spam.
     
  6. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    I got something similar. It happens on very fast computers since the tick rate of the fixed server step is 60 and your framerate may be 500 fps.

    Is there no way to change the temp allocations warning limit by setting something somewhere in Unity? I think that would help get rid of the warning spam.
     
  7. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @CMarastoni @timjohansson Currently my project get serious issue for this TempJob allocations warning. It keep allocating 1MB per second at both editor and real android build until it crash when it's out of memory. Can u make sure at least this issue is fixed for next Netcode version even TempJob allocations warning still exists? Make it not allocate 1MB per second anymore. Btw it's Entities package or Netcode package related issue?
     
  8. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    If you are constantly allocating more than 1MB per second then it is a real leak. We are actually disposing the memory. The warning was actually a "false" positive due to the way the TempJob check works.
    I'm not aware of any reported leak in 0.6-preview.7 and has been used that in many other projects.
    Can you give us some more info about which system did that or where it came from?
     
  9. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @CMarastoni I'm not really sure where the leak came from but I know how to reproduce it in my project. I try find it for long time but still can't track it yet. I think u can use my repro project project to reproduce this memory leak. From UI Panel, press setting button then quit game button at game scene to go back to main menu scene you should able to reproduce the memory leak issue. If u can't reproduce it let me know.