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

@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)

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)


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.

You rock @timjohansson ! Thank you for the direction, will try this out

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:

System.InvalidOperationException: Fragmentation capacity exceeded
Thrown from job: Unity.Networking.Transport.FragmentationPipelineStage.Receive
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.
(Filename:  Line: 408)

6807164--789875--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.