SoftwareGuy / Ignorance

Ignorance utilizes the power of ENet to provide a reliable UDP networking transport for Mirror Networking.
Other
248 stars 31 forks source link

Ignorance remains in the Disconnecting client state even though the disconnect has occurred #83

Closed Nukiesto closed 2 years ago

Nukiesto commented 2 years ago

I disconnect via StopHost () from NetworkManager v55.3.8 Mirror I get this error when disconnecting

NullReferenceException: Object reference not set to an instance of an object
IgnoranceTransport.Ignorance.ProcessClientPackets () (at Assets/Mirror/Runtime/Transport/Ignorance/Ignorance.cs:535)
IgnoranceTransport.Ignorance.ClientPump () (at Assets/Mirror/Runtime/Transport/Ignorance/Ignorance.cs:431)
IgnoranceTransport.Ignorance.FixedUpdate () (at Assets/Mirror/Runtime/Transport/Ignorance/Ignorance.cs:629)

NullReferenceException: Object reference not set to an instance of an object
IgnoranceTransport.Ignorance.ProcessClientPackets () (at Assets/Mirror/Runtime/Transport/Ignorance/Ignorance.cs:535)
IgnoranceTransport.Ignorance.ClientPump () (at Assets/Mirror/Runtime/Transport/Ignorance/Ignorance.cs:431)
IgnoranceTransport.Ignorance.Update () (at Assets/Mirror/Runtime/Transport/Ignorance/Ignorance.cs:641)
SoftwareGuy commented 2 years ago

What version of Ignorance are you using? I thought I patched this in v1.4.0 Gold Release 0...

Nukiesto commented 2 years ago

Ignorance 1.4.0 LTS Release 0

SoftwareGuy commented 2 years ago

Tell me how to replicate this, as on Mirror LTS this shouldn't happen.

Nukiesto commented 2 years ago

This happens in an empty project on Unity 2021.2.7f1

SoftwareGuy commented 2 years ago

Will investigate with updated mirror sometime this week.

Nukiesto commented 2 years ago

How is the problem being solved?

SoftwareGuy commented 2 years ago

Scheduled to look at it this week as last week as my first week back doing IRL tech support.

Taking a quick look at it now... Line 536 is:

            while (Client.ConnectionEvents.TryDequeue(out IgnoranceConnectionEvent connectionEvent))

So it looks like somehow either ConnectionEvents is null, or the Client is null.... This to me smells like Mirror changed something...

SoftwareGuy commented 2 years ago

Okay so looking at ConnectionEvents in the client code we have this:

public RingBuffer<IgnoranceConnectionEvent> ConnectionEvents;

...but that should be initializing, I don't think I need to explictly say = new ... after it.

I'll investigate what Mirror is doing and see if they changed/broke something.

SoftwareGuy commented 2 years ago

Isolated the problem and apparently Mirror now is calling ClientDisconnect() even in HostClient mode causing Ignorance to go crazy with the NREs due to the client state being changed from Disconnected to Disconnecting. The git commit patches this, release will be available within an hour.