planetarium / libplanet

Blockchain in C#/.NET for on-chain, decentralized gaming
https://docs.libplanet.io/
GNU Lesser General Public License v2.1
506 stars 142 forks source link

Unexpected error occurred during CreatePermission: System.Net.Sockets.SocketException (10056): 이미... #969

Closed sentry-io[bot] closed 1 year ago

sentry-io[bot] commented 4 years ago

Sentry Issue: 9C-STANDALONE-PP

Unexpected error occurred during CreatePermission: System.Net.Sockets.SocketException (10056): 이미 연결된 소켓에서 다른 연결을 요청했습니다.
   at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
   at Libplanet.Stun.TurnClient.EnsureConnection()
   at Libplanet.Stun.TurnClient.CreatePermissionAsync(IPEndPoint peerAddress, CancellationToken cancellationToken)
   at Libplanet.Net.NetMQTransport.CreatePermission(BoundPeer peer)
sentry-io[bot] commented 4 years ago

Sentry issue: 9C-STANDALONE-RB

longfin commented 4 years ago

Because the Connected property only reflects the state of the connection as of the most recent operation, you should attempt to send or receive a message to determine the current state. After the message send fails, this property no longer returns true. Note that this behavior is by design. You cannot reliably test the state of the connection because, in the time between the test and a send/receive, the connection could have been lost. Your code should assume the socket is connected, and gracefully handle failed transmissions.

https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.tcpclient.connected?view=netcore-3.1#remarks

We may rethink the handling of connection stabilization with TurnClient.EnsureConnection(). 😕

longfin commented 4 years ago

Continued from https://github.com/planetarium/libplanet/pull/972#issuecomment-682069085

It would be better if we moved TURN related tasks(e.g. RefreshAllocation) from NetMQTransport to TurnClient because we can organize re-connecting codes into only TurnClient, not NetMQTransport.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.