Unity .NET 4.6 Socket Exception
Since upgrading to Unity 2017.2.1.p1, we have been experiencing Socket Exception in Photon Unity Networking when passing larger amounts of data to clients via RPC.
After consulting with the dev team at Exit Games, it seems the problem is more related to .NET 4.6 than it is the Photon plugin, as it does not occur when switching back to .NET 3.5. Previous version of the editor, i.e. 2017.1.1p1 do not reproduce the error.
The attached file has a complete problem description as well as links to two sample projects, one created in 2.1p1 to reproduce the error, and the other in 1.1p1 to prove that it was working without issue in the previous version.
Any help would be greatly appreciated.link text
Answer by cattendu3d · Feb 08, 2018 at 03:39 PM
Hello @justinvirtualitics,
I followed your instructions and was unable to reproduce the bug you described. Perhaps I'm doing something wrong?
I downloaded your projects; started two instances of the 2017.2.1p1 build; connected one as Host and waited for it to finish loading; connected the 2nd one as Client.
At this point they are connected together and in the same level.
I then go to the Host instance and press Space; I get the confirmation that the 75 [0,74] chunks of data are successfuly sent; I also the confirmation they were received from the Client. No crashes...
I have tried reproducing the bug with all combinations of 2017.1.1p1/2017.2.1p1 builds, projects, rebuilding from project source, using two different computers, etc.
Could you provide additionnal information as to the machine you are trying to run this on? Have I missed a step? Any and all information will help me to resolve this issue! :)
Thanks for your reply @cattendu3d.
It sounds like you are testing everything and following the proper steps. Unfortunately, we are still experiencing the issue on the 2017.2.1.p1 build, across several different machines. Some are ASUS ROG VR ready machines, others are custom built rigs (i7-7600,GTX 1080, 32GB RA$$anonymous$$). An engineer from Photon was able to reproduce the issue as described in our doc to the extent that they confirmed the issue is co$$anonymous$$g from .NET's Socket class, not their wrapper. There is no crash, just a disconnection, and an error saying "Not Connected, not bound" on the host.
We tend to fail between 10 and 50 chunks. We're not sure, but if it's related to the quality of your internet connection, you way want to increase the amount of data you are sending. If the 1.5 mb package is being received properly on the client, try changing the size of "dataToSync" in DataSet$$anonymous$$anager.cs line 41 located in the GenerateData method. You can try doubling the byte array size to 3000000 (3 mb) and try again.
Alright... so I was unable to reproduce the disconnect by increasing the byte array size (went up to 100mb!), but increasing the maxBytesPerChunk did the trick. I'll look further into the issue and comme back to you with what I find!
Great! I should have mentioned that shrinking our maxBytesPerChunk has helped us get around the issue temporarily for further development, but this isn't a viable long term solution. We've had to multiply by 0.25, and don't want to tell our clients that data transmission will be 4x SLOWER on our next update!
Answer by justinvirtualitics · Feb 13, 2018 at 04:43 AM
@cattendu3d Any progress on tracking down the issue?
Yes I've almost finished tracking down the changeset which introduced the issue. I'll open a bug report when I do and I'll provide the link to it in this thread. I get back to you as soon as I'm done, sorry for the delay!
Hi JustinVirtualitics, Don't worry, I haven't forgotten you! I have been busy with other stuff as QA and debugging is not my primary task. In order to speed up the process, I suggest you produce a bug report (https://unity3d.com/unity/qa/bug-reporting) with your project and the explanations you've provided (I also suggest linking to this page). I will add my findings to your bug report and they will let you know if they have found the issue.