Wednesday 24 April 2013

Beware Ping.Send and the BSOD

The application I'm working on is a partially connected client-server application, it uses a mesh network and/or 3G to synchronise databases.

To test if the client and server could communicate the Ping.Send method seemed like a good place to start (although it's not ideal, an actual WCF service has to be available too). However, if you interrupt Ping.Send mid flight... BSOD. This is only really a problem in development, if the ping is returning in a reasonable amount of time then the chances of interrupting it are slim, but if the server is unavailable, and the ping time-out is too high, and I'm stopping and restarting the application frequently this leads to 4 or 5 blue screens a day.

Disclaimer, it's something at the OS/driver level that actually causes the BSOD, I've not diagnosed exactly what and I probably wont bother, it might be something specific to my network card or could be something in Windows itself but there are plenty of other people seeing the same thing, for example...

http://social.technet.microsoft.com/Forums/en-US/w7itpronetworking/thread/1f847268-e38d-4ac3-a1ea-f41069604fd0/

http://connect.microsoft.com/VisualStudio/feedback/details/721557/bluescreen-process-has-locked-pages-netframework-ping-send

http://connect.microsoft.com/VisualStudio/feedback/details/691615/stopping-debugging-session-while-waiting-for-pingreply-causes-bsod

This final link suggests and excellent workaround...
The bug seems to appear only on .NET Framework 4.0. I do not know if the bug is in .NET 3.5 as well. I have checked, that the .NET Framework 2.0 does not show this bug. Therefore, to avoid this bug, switch back to that framework version.
...or maybe not.

No comments:

Post a Comment