Skip to content

"Cannot access a disposed object" thrown OnClientDisconnect() #127

@Drakenfrost

Description

@Drakenfrost

Hi there.

This error only occurs:

  • on the server.
  • when the client disconnecting is NOT also a host. Hosts stop perfectly fine.

The error seems to be caused by the base implementation of 'OnStopClient' called from the base 'OnClientDisconnect' method.

I am using the Multiplex Transport but currently only have Telepathy running.

I've tried first removing the client's ownership of all their owned objects as well as the player object. This did not help.

Here is the log:

ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.
  at System.Net.Sockets.Socket.ThrowIfDisposedAndClosed () [0x0001b] in <8c9cb336fa2042c285391d24de6e4092>:0 
  at System.Net.Sockets.Socket.get_RemoteEndPoint () [0x00000] in <8c9cb336fa2042c285391d24de6e4092>:0 
  at Telepathy.Server.GetClientAddress (System.Int32 connectionId) [0x00014] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\Transports\Telepathy\Telepathy\Server.cs:324 
  at Mirror.TelepathyTransport.ServerGetClientAddress (System.Int32 connectionId) [0x00002] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\Transports\Telepathy\TelepathyTransport.cs:197 
  at Mirror.MultiplexTransport.ServerGetClientAddress (System.Int32 connectionId) [0x00011] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\Transports\MultiplexTransport.cs:224 
  at Mirror.NetworkConnectionToClient.get_address () [0x00000] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\NetworkConnectionToClient.cs:10 
  at CustomNetworkManager.OnServerDisconnect (Mirror.NetworkConnectionToClient conn) [0x00009] in D:\Unity\Repos\WitheredWillows\Assets\ScriptLibrary\GuardianOfElderidge\Networking\CustomNetworkManager.cs:51 
  at Mirror.NetworkServer.OnTransportDisconnected (System.Int32 connectionId) [0x00027] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\NetworkServer.cs:600 
  at Mirror.MultiplexTransport+<>c__DisplayClass18_0.<AddServerCallbacks>b__3 (System.Int32 baseConnectionId) [0x00001] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\Transports\MultiplexTransport.cs:194 
  at Mirror.TelepathyTransport.<ServerStart>b__27_2 (System.Int32 connectionId) [0x00000] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\Transports\Telepathy\TelepathyTransport.cs:173 
  at Telepathy.Server.Tick (System.Int32 processLimit, System.Func`1[TResult] checkEnabled) [0x00098] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\Transports\Telepathy\Telepathy\Server.cs:382 
  at Mirror.TelepathyTransport.ServerEarlyUpdate () [0x00010] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\Transports\Telepathy\TelepathyTransport.cs:229 
  at Mirror.MultiplexTransport.ServerEarlyUpdate () [0x00012] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\Transports\MultiplexTransport.cs:35 
  at Mirror.NetworkServer.NetworkEarlyUpdate () [0x00010] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\NetworkServer.cs:1717 
  at Mirror.NetworkLoop.NetworkEarlyUpdate () [0x00001] in D:\Unity\Repos\WitheredWillows\Assets\Plugins\Mirror\Runtime\NetworkLoop.cs:193

(Filename: D:/Unity/Repos/WitheredWillows/Assets/Plugins/Mirror/Runtime/Transports/Telepathy/Telepathy/Server.cs Line: 324)

Currently I just commented out line 324 in Telepathy.Server which has the trouble method 'GetClientAddress' as seen at the top of the stack above.

Please let me know what further information I can provide. Thanks in advance for any assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions