Failing communication with Bitcoin node: Only one usage of each socket address (protocol/network address/port) is normally permitted

0

I use the cryptean's BitcoinLib to make RPC calls to a Bitcoin node on another computer. Seemingly at random, the connection fails and I get a System.Net.Sockets.SocketException with the error code Only one usage of each socket address (protocol/network address/port) is normally permitted. I don't know if this is due to a race condition on the port number distribution on the local machine or a bug in BitcoinLib.

Here is the complete stack trace

  • 2018-08-15 08:48:12.5570 Fetching transaction from Bitcoin node, txid=3586d46be7bb1875fede4349849b89daf5ed73320979da211a54146c7bd90bfb.
  • 2018-08-15 08:48:12.5831 Failed during communication with Bitcoin node.
  • 2018-08-15 08:48:12.5831 An unknown web exception occured while trying to read the JSON response
  • 2018-08-15 08:48:12.5831 System.Net.WebException: Only one usage of each socket address (protocol/network address/port) is normally permitted Only one usage of each socket address (protocol/network address/port) is normally permitted ---> System.Net.Http.HttpRequestException: Only one usage of each socket address (protocol/network address/port) is normally permitted ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask 1 creationTask) at System.Threading.Tasks.ValueTask 1.get_Result()
    at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at System.Net.HttpWebRequest.SendRequest() at System.Net.HttpWebRequest.GetResponse() --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetResponse() at BitcoinLib.RPC.Connector.RpcConnector.MakeRequest[T](RpcMethods rpcMethod, Object[] parameters)
  • 2018-08-15 08:48:12.5831 at BitcoinLib.RPC.Connector.RpcConnector.MakeRequest[T](RpcMethods rpcMethod, Object[] parameters)

Thorkil Værge

Posted 2018-08-15T09:03:38.723

Reputation: 637

Answers

0

The problem was caused by my server making too many simultaneous requests to the same node. The computer making the requests imply ran out of ports to use.

Thorkil Værge

Posted 2018-08-15T09:03:38.723

Reputation: 637