Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug [NetCode] GhostSendSystem.SerialzieJob.sendEntities FAILS on Release Build Configuration

Discussion in 'NetCode for ECS' started by adammpolak, Feb 4, 2021.

  1. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    @timjohansson apologies for all the pings but I was able to pin point what the issue is.

    It appears that the GhostSendSystem.SerializeJob.SendEntities() fails on release builds.


    Job.Worker 4 (13): EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=2867 MB, unused=0x0)

    upload_2021-2-4_10-10-10.png

    Could it be that it needs to send 2k ghosted entities and it is using GhostRelevancy?
    (this does not happen if the Build configuration is Debug or Develop)
     

    Attached Files:

    Last edited: Feb 4, 2021
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    I suspect this is caused by too many irrelevant ghosts causing snapshots to be larger than one MTU and require fragmentation because we despawn all of them at once.
    There is a bug with fragmentation pipeline initialization in NetworkStreamReceiveSystem - if you change line ~114 (in CreateServerDriver) to driver = NetworkDriver.Create(reliabilityParams, fragmentationParams); that might be enough to fix it. You can also create a custom INetworkStreamDriverConstructor and assign it to NetworkStreamReceiveSystem.s_DriverConstructor during bootstrap if you want to tweak the pipeline parameters without modifying the package.
     
  3. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    You rock @timjohansson ! Thank you for the direction, will try this out
     
  4. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    This works! (once)

    I can now run in release mode and the initial error no longer occurs (woo!)

    BUT...

    - I am in NavigationScene and hit "host game" (this bootstraps client/server worlds then triggers MainScene)
    - MainScene now loads and works! (nice!)
    - I hit "quit" to return to NavigationScene
    - If I hit "host game" again it will will crash with "Fragmentation capacity exceeded"

    I get an error:
    Code (CSharp):
    1. System.InvalidOperationException: Fragmentation capacity exceeded
    2. Thrown from job: Unity.Networking.Transport.FragmentationPipelineStage.Receive
    3. This Exception was thrown from a job compiled with Burst, which has limited exception support. Turn off burst (Jobs -> Burst -> Enable Compilation) to inspect full exceptions & stacktraces. In this standalone build configuration burst will now abort the Application.
    4. (Filename:  Line: 408)
    upload_2021-2-5_13-22-28.png


    So it seems to only work once.
    This is odd because I totally destroy all of ECS when returning to NavigationScene (Worlds.Dispose and UniversalQuery delete all entities)
    So I wonder why this error is stateful.