[Mono-bugs] [Bug 591136] New: System.Net.NetworkInformation.Ping unreliable when running as a user other than root.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Mar 25 11:00:51 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=591136

http://bugzilla.novell.com/show_bug.cgi?id=591136#c0


           Summary: System.Net.NetworkInformation.Ping unreliable when
                    running as a user other than root.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: x86
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: dennis.lafosse at teradyne.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=350570)
 --> (http://bugzilla.novell.com/attachment.cgi?id=350570)
Source for a small program that reproduces the problem.

User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152;
NET CLR 3.5.30729)

Unless a large timeout value is supplied, the method
System.Net.NetworkInformation.Ping.Send times out more often than not. This
happens even when pinging 127.0.0.1. However, simply entering "ping 127.0.0.1"
at the command line succeeds.

I've traced the problem to the method SendUnprivileged in the Ping class. There
is a line of code (line ~284 file Ping.cs):
if (!ping.WaitForExit (timeout) || (ping.HasExited && ping.ExitCode == 2))
that waits for a spawned process to timeout. I've learned that if I replace
that line of code with the following:
System.Threading.Thread.Sleep(timeout);
if (!ping.WaitForExit (0) || (ping.HasExited && ping.ExitCode == 2))
the method succeeds. I think this may point to a bug in the
System.Diagnostics.Process class rather than the Ping class, but maybe the
above is a valid workaround.

System details:
OS: CentOS 4.3
Kernel: 2.6.9-34.EL
This is a virtual machine, running on VMWare Server 1.0.4 Build 56528.


Reproducible: Always

Steps to Reproduce:
1.Compile the attached source file: gmcs Program.cs
2.Execute the binary: mono Program.exe 127.0.0.1 100
3.
Actual Results:  
Compile and execute the source. The app takes two command line arguments which
are the IP Address of the machine to ping, and a timeout in milliseconds. Using
a timeout of 100ms (nearly) always results in a status of TimedOut. If I
increase the timeout to 1000ms, it succeeds maybe 90% of the time. I've run the
same program on Windows, and I do not experience this problem.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list