ntdll.dll exception Access Violation - by Wynand

Status : 

 


1
0
Sign in
to vote
ID 442779 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 5/6/2009 5:55:27 AM
Access Restriction Public

Description

I get an exception when making use of the Ping class in .net2.0 when used in a loop with the async ping method. When this pingSender is disposed as sugested at http://blog.mbcharbonneau.com/2006/11/14/using-the-ping-class-in-net-20-without-memory-leaks/ to work around the memory leak. 

Our c# service crashes and writes this in the event log:
Faulting application GeViCentral.exe, version 1.1.88.56300, time stamp 0x4a016467, faulting module ntdll.dll, version 6.0.6001.18000, time stamp 0x4791a7a6, exception code 0xc0000005, fault offset 0x00043387, process id 0x968, application start time 0x01c9ce365364596e.
Sign in to post a comment.
Posted by Christopher Theunissen on 11/5/2009 at 8:58 AM
I had a similar problem on Windows 2008 with a service.

I worked around it by creating a new Ping object for each asynchonous request and then Dispose it in the PingCompleted event handler. I also dispose it in an exception handler if the SendAsync call throws an exception, as the PingCompleted event won't be fired then.

I pass the current Ping object as the userToken in the SendAsync call, so it is passed into the PingCompletedEvent as e.UserState so it can be disposed. The PingCompletedEvent always seems to be called when the SendAsync call does not throw an exception, so it is guaranteed to be disposed.

Using a separate ping object also means you won't end up with any of the exceptions like InvalidOperationException which indicates an exising asynchronous call is currently in progress.
Posted by Wynand on 5/7/2009 at 10:40 PM
Ok, but what am I suppose to do in the meantime? We have a big project that has a deadline in a month. This causes the service to crash and as mentioned previously it must have an uptime of 99.99% per year. Which leave me with a few hours at most to do routine maintenance. The site where this service is installed is on a different continent, so I cannot go there to restart the service...

What about the memory leak, can that be fixed earlier?
Posted by David [MSFT] on 5/7/2009 at 12:14 PM
This issue is planned to be fixed in the .NET Framework 4.0 release.

Thank you,

Network Class Library Team
Posted by Microsoft on 5/7/2009 at 2:17 AM
Thanks for your project.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team
Posted by Wynand on 5/7/2009 at 2:01 AM
I have uploaded a small console application as to where I think the problem lies.

It crashes within seconds after startup.

Al the application does is open a async ping request, and dispose the Ping instance before the reply comes back.

This is an over simplification of our service though, but it produces the same result I think.

I had to write this small application, it would be rather complex to setup our actual application there.

Thanks
Posted by Microsoft on 5/7/2009 at 12:26 AM
Thanks for reporting this issue. Could you please give us a demo project to demonstrate this issue?It will help me get a more concrete idea as to what the exact problem is, and how to resolve it efficiently. Please rest assured that it is for test purpose only. I have created a Workspace for you. Please upload the project file to it. Thanks for your time.

https://sftus.one.microsoft.com/choosetransfer.aspx?key=df9871dc-7384-4e97-81c3-10963ac8dd94

Password is 9sqNyFfl9r2#n0Ev
Posted by Wynand on 5/6/2009 at 5:57 AM
If the ping instance is disposed with ping.Dispose() it doesn't crash, however this results in a memory leak as our service must have an uptime of 99.99% per year.