Open jbruening opened 8 years ago
More information if it helps:
msg.Data was a valid byte array with 20215 bytes delivery method was UnreliableSequenced LengthBits was 161720
The code you pasted isn't part of the library... do you get this problem with the samples as well?
I have a simple program that can reproduce this issue
Just make a new project with a reference to a build from c42b885
This should also reproduce #43, but it doesn't seem to be. Increasing the time between clients connecting to something like 10 seconds might reproduce it.
Definitely a threading issue. Using the code in the pastebin, I put a few more variables to peek at the state of the incoming message before breaking.
The type also switched in that image from a Data to an Error, which I'm assuming is the reason for the nulls.
That commit doesn't seem to entirely fix the problem though.
Can you verify setting UseMessageRecycling to false suppressed the problem?
I shouldn't have deleted my previous message, it's definitely still happening -
The program stops working. The server starts getting statuschanged messages that are at the end of their array. Attempting to change the position to 0 does not help, as the messages are still constantly received.
Did you try UseMessageRecycling false? I also advice running in Debug as more checks are made there. I presume you are not manually recycling the message before it's read. I did some extra checks on recycling but was unable to detect any corruption in the library samples.
yes, that last message is with UseMessageRecycling set to false.
No, I am not manually recycling the message before it's being read. It's still the same program as what is in the pastebin link.
Debug build throws on an assert about it being out of bounds, before it attempts to do the read, but it's still effectively doing the same thing.
The chat example runs fine for me
This seems to be stemming from the UnreliableSizeBehaviour being set to NormalFragmentation.
Aha. UnreliableSizeBehaviour.NormalFragmentation is a very suspect feature kept mostly for backwards compability. It should never really be used as it stands right now. I'm hoping to implement fragmentation for unreliable messages better (some kind of timeout for collecting incomplete fragments) some day...
SenderConnection occasionally evaluates to null, and then suddenly isn't
built off c42b885