-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
NEST/Elasticsearch.Net version: 7.10.1
Elasticsearch version: 7.2.0
Description of the problem including expected versus actual behavior:
On Azure, when attempting to connect to my cluster, I receive this error for all requests when .EnableDebugMode()
is set on ConnectionSettings
:
message: "Access is denied.",
type: "System.Net.NetworkInformation.NetworkInformationException",
raw: "System.Net.NetworkInformation.NetworkInformationException (5): Access is denied.
at System.Net.NetworkInformation.SystemIPGlobalProperties.GetAllTcpConnections()
at System.Net.NetworkInformation.SystemIPGlobalProperties.GetActiveTcpConnections()
at Elasticsearch.Net.Diagnostics.TcpStats.GetStates()
at Elasticsearch.Net.HttpConnection.RequestAsync[TResponse](RequestData requestData, CancellationToken cancellationToken) at Elasticsearch.Net.RequestPipeline.CallElasticsearchAsync[TResponse](RequestData requestData, CancellationToken cancellationToken) at Elasticsearch.Net.Transport`1.RequestAsync[TResponse](HttpMethod method, String path, CancellationToken cancellationToken, PostData data, IRequestParameters requestParameters)",
After discussing with @russcam on Slack about this, it's potentially due to GetStates not working on Azure. (as it works on local).
For now, the workaround is to set .EnableTcpStats(false)
after calling EnableDebugMode()
so that TCP stats are not collected.
Steps to reproduce:
- Create a new Azure App Service (Windows)
- Deploy some code that connects to an Elasticsearch cluster, with
.EnableTcpStats()
(either explicitly, or implicitly via.EnableDebugMode()
etc
Expected behavior
Request should still succeed, and potentially TCP stats aren't available? (ie the request shouldn't crash). I think that a try/catch
around GetActiveTcpConnections
might be required:
elasticsearch-net/src/Elastic.Transport/Diagnostics/TcpStats.cs
Lines 23 to 24 in db51460
public static TcpConnectionInformation[] GetActiveTcpConnections() => | |
IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections(); |
Provide DebugInformation
(if relevant):
Thanks, and keep up the good work! 🎉