willardf / Hazel-Networking

Hazel Networking is a low level networking library for C# providing connection-oriented, message-based communication via RUDP.
MIT License
385 stars 60 forks source link

Exception: Duplicate add MessageReader #57

Closed aviv0099 closed 1 year ago

aviv0099 commented 1 year ago

Exception: Duplicate add MessageReader at Hazel.ObjectPool`1[T].PutObject (T item) [0x00000] in <00000000000000000000000000000000>:0 at Hazel.Udp.UdpConnection.HandleReceive (Hazel.MessageReader message, System.Int32 bytesReceived) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0 UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception)

(I am using the unity udp client) Happens only to people in Turkey that use the ISP "turkcell superonline", any idea where I can investigate to get to the root of the issue? after few seconds of connecting to the server they are getting the 6 pings error. EDIT: I read online that this ISP is using some kind of IPs cluster for their customers, it might be part of the problem, maybe enabling IPv6 would solve it? but the problem is that you can only choose v4 or v6 but not both, in the docs it says you can choose both and I'm not sure how. Thanks!

willardf commented 1 year ago

Most of the time duplicate add means that somehow MessageReader.Recycle is getting called twice. This usually is an error in your app's code (a recycle that shouldn't happen) that throws from hazel (the second recycle that should happen), but I can't completely deny the possibility something weird happens and Hazel does two recycles itself.

So I don't really thing that IPv4 vs IPv6 is part of the problem here, but just for the record, in my experience if you start Hazel in IPv6 mode, then it will handle IPv4 as well. But YMMV.