RevenantX / LiteNetLib

Lite reliable UDP library for Mono and .NET
https://revenantx.github.io/LiteNetLib/index.html
MIT License
3.06k stars 495 forks source link

Reliable channel stops working after 100% packet loss simulated #489

Closed RichBull closed 2 years ago

RichBull commented 2 years ago

Hi, we recently had an issue on our project where sending messages using DeliveryMethod.ReliableOrdered would occasionally seem to stall, and never recover. We think we've reproduced the issue in an isolated console testbed (source attached) by having a server process send reliable ordered packets continuously to a connected peer, then after a few seconds setting SimulationPacketLossChance to 100(%) for a couple of seconds before disabling it again, and observing that no more reliable ordered packets are received by the client after this time.

After a bit of digging, we found that if we add a call to AddToPeerChannelSendQueue(); on line 282 of ReliableChannel.cs, after the log but before the method returns false, it appears to resume sending/receiving again after the simulated packet loss, so we currently have this patched in locally to our project.

Does this appear to be a valid issue, and if so, is this fix correct?

Thanks!

Library version: [commit id (f364a6fe1b5755ea99ee1cb864755e277be74cbb)] LiteNetLibTestbed.cs.zip

RevenantX commented 2 years ago

@RichBull after i looked this is really possible problem. Your fix looks like correct.