Skip to content

Client experiences an ObjectDisposedException when host shuts down over Unity Relay #1542

Closed
@fernando-cortez

Description

@fernando-cortez

Describe the bug
Client runs into the following exception when a connected host over Unity Relay shuts down.

ObjectDisposedException: The Unity.Collections.NativeList`1[Unity.Networking.Transport.NetworkDriver+Connection] has been deallocated, it is not allowed to access it
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <07c89f7520694139991332d3cf930d48>:0)
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <07c89f7520694139991332d3cf930d48>:0)
Unity.Collections.NativeList`1[T].get_Length () (at Library/PackageCache/com.unity.collections@1.0.0-pre.5/Unity.Collections/NativeList.cs:232)
Unity.Networking.Transport.NetworkDriver.GetConnection (Unity.Networking.Transport.NetworkConnection id) (at Library/PackageCache/com.unity.transport@1.0.0-pre.7/Runtime/NetworkDriver.cs:1330)
Unity.Networking.Transport.NetworkDriver.GetConnectionState (Unity.Networking.Transport.NetworkConnection con) (at Library/PackageCache/com.unity.transport@1.0.0-pre.7/Runtime/NetworkDriver.cs:1110)
Unity.Netcode.UnityTransport.ProcessEvent () (at Library/PackageCache/com.unity.netcode.adapter.utp@1.0.0-pre.3/Runtime/UnityTransport.cs:459)
Unity.Netcode.UnityTransport.Update () (at Library/PackageCache/com.unity.netcode.adapter.utp@1.0.0-pre.3/Runtime/UnityTransport.cs:527)

To Reproduce
This issue was seen inside Boss Room and is easily reproduceable.
Steps to reproduce the behavior:

  1. Grab Unity-Technologies/com.unity.multiplayer.samples.coop@230d413.
  2. Have player A host via Unity Relay.
  3. Have player B connect with the host code.
  4. Have host stop editor or quit the application (if built).
  5. See error on player B.

Actual outcome
Exception was logged on a client.

Expected outcome
Exception should not be thrown when the host shuts down the connection.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. Windows 10]
  • Unity Version: [2020.3.21]
  • Netcode Version: [1.0.0-pre.3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions