Bug 42249 - Ping throws DNS not found exception
Summary: Ping throws DNS not found exception
Status: RESOLVED NORESPONSE
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-29 13:20 UTC by Jochen Kühner
Modified: 2018-03-13 11:07 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description Jochen Kühner 2016-06-29 13:20:18 UTC
When I try to use a Ping to a IP, I get the following Exception:

System.Net.Sockets.SocketException: Could not resolve host 'GFMM01746316'
  at System.Net.Dns.Error_11001 (System.String hostName) [0x00000] in /home/build/Schreibtisch/mono-4.2.3/mcs/class/System/System.Net/Dns.cs:292 
  at System.Net.Dns.GetHostByName (System.String hostName) [0x00024] in /home/build/Schreibtisch/mono-4.2.3/mcs/class/System/System.Net/Dns.cs:419 
  at System.Net.NetworkInformation.Ping.GetNonLoopbackIP () [0x00000] in /home/build/Schreibtisch/mono-4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:200 
  at System.Net.NetworkInformation.Ping.SendPrivileged (System.Net.IPAddress address, Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions options) [0x00008] in /home/build/Schreibtisch/mono-4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:226 
  at System.Net.NetworkInformation.Ping.Send (System.Net.IPAddress address, Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions options) [0x0005b] in /home/build/Schreibtisch/mono-4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:219 
  at System.Net.NetworkInformation.Ping.Send (System.Net.IPAddress address, Int32 timeout, System.Byte[] buffer) [0x00000] in /home/build/Schreibtisch/mono-4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:174 
  at System.Net.NetworkInformation.Ping.Send (System.Net.IPAddress address, Int32 timeout) [0x00000] in /home/build/Schreibtisch/mono-4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:169 
  at System.Net.NetworkInformation.Ping.Send (System.Net.IPAddress address) [0x00000] in /home/build/Schreibtisch/mono-4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:164 

i think
Comment 1 Jochen Kühner 2016-06-29 13:23:57 UTC
I think Problem is here: https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.NetworkInformation/Ping.cs#L243

this line throws the Exception
Comment 2 João Matos 2016-07-04 18:18:24 UTC
Can you send a small example that reproduces the problem?
Comment 3 Jochen Kühner 2016-07-05 04:27:15 UTC
I simple do
new Ping(). Send(IPAddress) 
on a Yocto Linux, wich has not is own hostname in the /etc/hosts file.

It's not more Code, only this one liner.
Comment 4 Fabrizio Carimati 2016-08-09 15:43:59 UTC
I just installed latest OpenSuse on Virtualbox.
Default hostname is "linux-4e98".

# ping $HOSTNAME
fail.

Mono/Ping fail as reported by Jochen Kühner with 
Could not resolve host 'linux-4e98'.

Adding in /etc/hosts
127.0.0.1  linux-4e98
resolve the issue in Mono.

So, the GetNonLoopbackIP throw an exception if the OS hostname can't be resolved.
I ignore why Mono/Ping need to resolve the hostname.
I still think it's a Mono bug.
Comment 5 Jochen Kühner 2016-11-16 12:02:46 UTC
I've uploaded a fix at : https://github.com/mono/mono/pull/3949
Comment 6 Marek Safar 2018-03-13 11:07:44 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and reopen the bug report.

Thank you!