Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception when disconnecting one of many clients in a console application #129

Open
PyrateAkananto opened this issue Dec 21, 2023 · 0 comments

Comments

@PyrateAkananto
Copy link
Contributor

It is possible to create multiple clients within a single console application (.NET 6 on Windows in my case). But if I create more than one client and then call Disconnect on the clients "usually" an error message including an exception is written to the console (see below).

When creating just one client that error does not appear. When creating two or three clients this error "sometimes" appears, but not always. When creating four or more clients this error "usually" appears, for some but not all created clients. This behavior obviously is not deterministic.

Attached is TelepathyExperiment.cs.txt which is a minimal example. In it the amount of created game clients is set as a command line parameter.

Am I using Telepathy in a wrong way? Is this expected behavior? Or is this not intended and could be fixed in Telepathy?

ReceiveLoop: finished receive function for connectionId=0 reason: System.Threading.ThreadInterruptedException: Thread was interrupted from a waiting state.
   at System.Threading.Monitor.ReliableEnter(Object obj, Boolean& lockTaken)
   at System.Resources.ResourceManager.AddResourceSet(Dictionary`2 localResourceSets, String cultureName, ResourceSet& rs)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at System.Resources.ResourceManager.GetString(String name)
   at System.SR.GetResourceString(String resourceKey)
   at System.SR.get_net_io_readfailure()
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at Telepathy.NetworkStreamExtensions.ReadSafely(NetworkStream stream, Byte[] buffer, Int32 offset, Int32 size) in C:\MyProject\Telepathy\NetworkStreamExtensions.cs:line 18
   at Telepathy.NetworkStreamExtensions.ReadExactly(NetworkStream stream, Byte[] buffer, Int32 amount) in C:\MyProject\Telepathy\NetworkStreamExtensions.cs:line 55
   at Telepathy.ThreadFunctions.ReadMessageBlocking(NetworkStream stream, Int32 MaxMessageSize, Byte[] headerBuffer, Byte[] payloadBuffer, Int32& size) in C:\MyProject\Telepathy\ThreadFunctions.cs:line 55
   at Telepathy.ThreadFunctions.ReceiveLoop(Int32 connectionId, TcpClient client, Int32 MaxMessageSize, MagnificentReceivePipe receivePipe, Int32 QueueLimit) in C:\MyProject\Telepathy\ThreadFunctions.cs:line 121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant