-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
SocketHttpHandler: exception is missing host/port text #1326
Comments
Triage: Would be really useful for (production) diagnostics - something we should improve in 5.0. |
The issue is rooted in runtime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs Line 122 in 19bb2a5
On the synchronous path, the IP+Port information is available in locals, to get it in an asynchronous completion, we need access contextual information on runtime/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs Line 67 in 19bb2a5
Since the field is not visible from |
Triage: It is ok to report just host name + port (we do not have IP available for host name resolving to multiple IPs). |
@karelz From my description, for example: Can i detect if i got stuck at an application visible proxy or the destination server?
Does that mean it will attempt to connect all IP addresses in order or only use the first one? If it picks a specific one and does not attempt to connect to the other IP addresses, the choosen IP address should be printed, to allow determining if there's a particular faulty server. |
@Suchiman when you are sending requests trough a proxy server, the "real" destination won't be transparent to you, With our new proposal you will observe the hostname of the proxy server in the exception message when connecting through a proxy, which should help you distinguishing between the two cases, even if it's not (always) the IP of the proxy. Does this make sense or am I missing some piece of information about your use case? Edit |
@antonfirsov hm yes that makes sense. |
@Suchiman just to make sure I understand you correctly: You state that, when you are not using a proxy, it's helpful information for you to see the IP address instead of the hostname, right? This would be great, but we we can achieve it only in future versions (post .NET 5), since we need part of #33418 to make that happen. For now, we are aiming for a solution that is good enough for most users. As a workaround, you can use |
@antonfirsov yes, correct. It is useful when evaluating the logs if it is always the same address that is failing and which one it is when the
Ok, that is fine, it's not a blocker (just makes this particular scenario easier to diagnose). |
In case of multiple IP-s, the connection algorithm will try all of them in the order returned by |
Tagging subscribers to this area: @dotnet/ncl |
Changed the title to better reflect the details and the actual diagnostic info we are missing. I don't think the IP info that we print in synchronous exceptions is really valuable because of the reasons we discussed in previous comments. @Suchiman a fix for the re-scoped issue is on the way in #38131. If you think you will be still missing important diagnostic information with this fix, feel free to open a new issue! |
When making HTTP requests, the inner SocketException used to print the IP Adress and Port which is quite useful for troubleshooting, e.g.
One thing you could easily spot by this was if you're getting stuck at a proxy or the real deal.
The SocketsHttpHandler does not appear to print them.
The text was updated successfully, but these errors were encountered: