Search Unity

com.unity.transport 0.6.0-preview.7

Discussion in 'NetCode for ECS' started by hugeandy, Feb 9, 2021.

  1. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Hi all,

    I can't find a better place to post this - it is not in relative to the netcode package itself, but the transport package. Please let me know if there is a better place to post it!

    I am currently experimenting with the fragmentation pipeline stage so that I can send larger packets. I am currently experiencing a crash (stacktrace below) which happens at seemingly random places. I *think* it is when packet size is between 1350 and 1400, however I am still looking into it in more detail.

    Whilst I investigate further, I thought I would raise a few questions that I had so far, and then update the post if I discover anything new.

    1. Can the fragmentation stage be used in combination with the reliable sequenced and unreliable sequenced stages?

    2. Where in the pipeline should the fragmentation stage go? My gut says it should be the final stage, however we also have a simulator stage and I think that should be the final stage, so it guess it should be the 2nd to last stage?

    The below stack trace is when sending using a combination of unreliable, fragmentation and simulator stages. Unreliable is the first stage, and I have tried fragmention and simulator in either order however I still get the same crash.

    Any help would be greatly appreciated!

    Cheers,
    Andy

    Code (CSharp):
    1. ========== OUTPUTTING STACK TRACE ==================
    2.  
    3. 0x00007FFF23C4F076 (lib_burst_generated) [C:\BuildAgent\work\69a805ec5677a170\Library\PackageCache\com.unity.transport@0.6.0-preview.7\Runtime\Pipelines\FragmentationPipelineStage.cs:79] Unity.Networking.Transport.FragmentationPipelineStage.Send
    4. 0x00007FFF23C50359 (lib_burst_generated) a2fea2e3b114f5fd136a9e7079c2fa6d_x64_sse2
    5. 0x00007FFF23C6EB5A (lib_burst_generated) a2fea2e3b114f5fd136a9e7079c2fa6d
    6. 0x000000403718234F (Mono JIT Code) (wrapper managed-to-native) object:wrapper_native_00007FFF23C6EB50 (Unity.Networking.Transport.NetworkPipelineContext&,Unity.Networking.Transport.InboundSendBuffer&,Unity.Networking.Transport.NetworkPipelineStage/Requests&)
    7. 0x000000403716BACA (Mono JIT Code) [C:\BuildAgent\work\69a805ec5677a170\Library\PackageCache\com.unity.transport@0.6.0-preview.7\Runtime\NetworkPipeline.cs:505] Unity.Networking.Transport.NetworkPipelineProcessor/Concurrent:ProcessSendStage (int,int,int,Unity.Networking.Transport.NetworkPipelineProcessor/PipelineImpl,Unity.Collections.NativeList`1<int>&,Unity.Networking.Transport.NetworkPipelineContext&,Unity.Networking.Transport.InboundSendBuffer&,Unity.Networking.Transport.NetworkPipelineStage/Requests&)
    8. 0x000000403716AE83 (Mono JIT Code) [C:\BuildAgent\work\69a805ec5677a170\Library\PackageCache\com.unity.transport@0.6.0-preview.7\Runtime\NetworkPipeline.cs:383] Unity.Networking.Transport.NetworkPipelineProcessor/Concurrent:ProcessPipelineSend (Unity.Networking.Transport.NetworkDriver/Concurrent,int,Unity.Networking.Transport.NetworkPipeline,Unity.Networking.Transport.NetworkConnection,Unity.Networking.Transport.NetworkInterfaceSendHandle,int,Unity.Collections.NativeList`1<Unity.Networking.Transport.NetworkPipelineProcessor/UpdatePipeline>)
    9. 0x000000403716A303 (Mono JIT Code) [C:\BuildAgent\work\69a805ec5677a170\Library\PackageCache\com.unity.transport@0.6.0-preview.7\Runtime\NetworkPipeline.cs:295] Unity.Networking.Transport.NetworkPipelineProcessor/Concurrent:Send (Unity.Networking.Transport.NetworkDriver/Concurrent,Unity.Networking.Transport.NetworkPipeline,Unity.Networking.Transport.NetworkConnection,Unity.Networking.Transport.NetworkInterfaceSendHandle,int)
    10. 0x0000004037169AC3 (Mono JIT Code) [C:\BuildAgent\work\69a805ec5677a170\Library\PackageCache\com.unity.transport@0.6.0-preview.7\Runtime\NetworkDriver.cs:259] Unity.Networking.Transport.NetworkDriver/Concurrent:EndSend (Unity.Networking.Transport.DataStreamWriter)
    11. 0x0000004037169533 (Mono JIT Code) [C:\BuildAgent\work\69a805ec5677a170\Library\PackageCache\com.unity.transport@0.6.0-preview.7\Runtime\NetworkDriver.cs:974] Unity.Networking.Transport.NetworkDriver:EndSend (Unity.Networking.Transport.DataStreamWriter)
    12. 0x0000004037167713 (Mono JIT Code) [C:\BuildAgent\work\69a805ec5677a170\Packages\com.hugecalf.netcode\Runtime\NetPacketHandler.cs:382] hugecalf.netcode.NetPacketHandler:WriteBytesToDriver (bool,hugecalf.netcode.NetConn,int,System.Type)
    13. 0x0000004037197A73 (Mono JIT Code) [C:\BuildAgent\work\69a805ec5677a170\Packages\com.hugecalf.netcode\Runtime\ServerNetPacketHandler.cs:40] hugecalf.netcode.ServerNetPacketHandler:SendToAll (hugecalf.IByteReadable)
    14. 0x00000040371513C3 (Mono JIT Code) [C:\BuildAgent\work\69a805ec5677a170\Assets\Scripts\net\server\addons\XXXXXXGameServerAddOn.cs:209] net.server.addons.XXXXXXGameServerAddOn:FixedUpdate ()
    15. 0x0000004013D5DA80 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    16. 0x00007FFF2130DB10 (mono-2.0-bdwgc) mono_get_runtime_build_info
    17. 0x00007FFF21292902 (mono-2.0-bdwgc) mono_perfcounters_init
    18. 0x00007FFF2129B95F (mono-2.0-bdwgc) mono_runtime_invoke
    19. 0x00007FFF136D487D (UnityPlayer) scripting_method_invoke
    20. 0x00007FFF136D14BC (UnityPlayer) ScriptingInvocation::Invoke
    21. 0x00007FFF136B4AA3 (UnityPlayer) MonoBehaviour::CallMethodIfAvailable
    22. 0x00007FFF136B4B88 (UnityPlayer) MonoBehaviour::CallUpdateMethod
    23. 0x00007FFF13059050 (UnityPlayer) BaseBehaviourManager::CommonUpdate<FixedBehaviourManager>
    24. 0x00007FFF1305FC9D (UnityPlayer) FixedBehaviourManager::Update
    25. 0x00007FFF13305554 (UnityPlayer) `InitPlayerLoopCallbacks'::`2'::FixedUpdateScriptRunBehaviourFixedUpdateRegistrator::Forward
    26. 0x00007FFF132F48BC (UnityPlayer) ExecutePlayerLoop
    27. 0x00007FFF132F4987 (UnityPlayer) ExecutePlayerLoop
    28. 0x00007FFF132F9224 (UnityPlayer) PlayerLoop
    29. 0x00007FFF12DAA87B (UnityPlayer) PerformMainLoop
    30. 0x00007FFF12DA948A (UnityPlayer) MainMessageLoop
    31. 0x00007FFF12DAD996 (UnityPlayer) UnityMainImpl
    32. 0x00007FFF12DAECCB (UnityPlayer) UnityMain
    33. 0x00007FF66A6211F2 (XXXX) __scrt_common_main_seh
    34. 0x00007FFF2D2813F2 (KERNEL32) BaseThreadInitThunk
    35. 0x00007FFF2D9854F4 (ntdll) RtlUserThreadStart
    36.  
    37. ========== END OF STACKTRACE ===========
     
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    Yes, they are supposed to work together.

    I would put the fragmentation stage before the reliability stage, that way reliability makes each fragment reliable. If you do it the other way around you would have to re-transmit all the fragments if a single one is lost. I'm not sure it even works to have reliable before fragmentation, reliable might not be able to deal with packets larger than the MTU.

    For the crash - I have not seen it before, can you please report a bug through the built-in bug reporter?
     
  3. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Thanks for the quick reply and the info, that all makes sense.

    For the crash - I will try to create a minimal repro project and upload it.

    Cheers,
    Andy
     
    Last edited: Feb 9, 2021
  4. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    @timjohansson I have been able to reliably reproduce the crash. It would seem that when sending packets of length 1386, 1387 or 1388 there is a problem with the fragmentation stage.

    In the editor: if burst is enabled, sending packets of these lengths will throw an exception. If burst is disabled, Unity crashes.
    In a build: the player crashes.

    I have made a project and reported with the bug report tool (1313547)

    Cheers,
    Andy