exception when disconnecting one of many clients in a console application
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- networking
Research direction
Start with the attached TelepathyExperiment.cs.txt and reproduce disconnecting multiple clients on .NET 6. Trace the ThreadInterruptedException through ThreadFunctions.ReceiveLoop and NetworkStreamExtensions.ReadSafely/ReadExactly, then verify that disconnecting all clients no longer produces an unexpected console exception.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 141
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MirrorNetworking/Telepathy
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
MirrorNetworking/Telepathy#132 ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
MirrorNetworking/Telepathy#135 ·
-
unity2022 Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
MirrorNetworking/Telepathy#133 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
MirrorNetworking/Telepathy#131 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
MirrorNetworking/Telepathy#127 · 2 comments ·
All issues in MirrorNetworking/Telepathy
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·