Troubleshoot OS Lock-up

  • Thread starter Thread starter eschneider
  • Start date Start date
E

eschneider

Hello,

I'm looking for some help on troublehooting a OS Lock-up issue. I can
reproduce the problem in my large solution, but I'm currently unable to
create a small reproducable sample to submit to anyone else.

I plan to try a Win debug dump tonight.
I have tried the Managed Stack Explorer, but it does not run on Vista Home
Premium.

This is related to:
microsoft.public.dotnet.framework.drawing: DrawReversibleLine issues in
Vista


Thanks,
Eric Schneider
 
Hi Eric,

The DrawReversibleLine method simply calls Windows GDI APIs to have its
task done. Looks like this:

[UIPermission(SecurityAction.LinkDemand,
Window=UIPermissionWindow.AllWindows)]
public static void DrawReversibleLine(Point start, Point end, Color
backColor)
{
int nDrawMode = GetColorRop(backColor, 10, 7);
IntPtr handle = UnsafeNativeMethods.GetDCEx(new HandleRef(null,
UnsafeNativeMethods.GetDesktopWindow()), NativeMethods.NullHandleRef,
0x403);
IntPtr ptr2 = SafeNativeMethods.CreatePen(0, 1,
ColorTranslator.ToWin32(backColor));
int num2 = SafeNativeMethods.SetROP2(new HandleRef(null, handle),
nDrawMode);
IntPtr ptr3 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, UnsafeNativeMethods.GetStockObject(5)));
IntPtr ptr4 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, ptr2));
SafeNativeMethods.MoveToEx(new HandleRef(null, handle), start.X,
start.Y, null);
SafeNativeMethods.LineTo(new HandleRef(null, handle), end.X, end.Y);
SafeNativeMethods.SetROP2(new HandleRef(null, handle), num2);
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr3));
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr4));
SafeNativeMethods.DeleteObject(new HandleRef(null, ptr2));
UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new
HandleRef(null, handle));
}

And the Splitter control uses a similar approach to draw the splitter (GDI
function PatBlt).

If you're familiar with some other unmanaged language (VB6 or C++), you can
try call these functions in the exactly the same way to simulate the same
task you want to do in your project, and see if the machine still gets
hung. This way you may be able to narrow down the problem - to see if this
is .NET specific or it is in GDI.

The problem could also be caused by the video driver (I've seen cases where
app got hung/crash while doing certain graphic operations, and the problem
gone after upgrading/downgrading the video driver). Especially if this
problem only happens on a single machine or on machines with the same
hardware/driver configuration but not reproducable on other machines.

So could you let me know whether or not the problem is reproducable on all
Vista machines with different graphic cards/drivers? If you don't have
spare machines to test, you can also try on a virtual machine.

Waiting for more information.

Regards,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Eric,

The DrawReversibleLine method simply calls Windows GDI APIs to have its
task done. Looks like this:

[UIPermission(SecurityAction.LinkDemand,
Window=UIPermissionWindow.AllWindows)]
public static void DrawReversibleLine(Point start, Point end, Color
backColor)
{
int nDrawMode = GetColorRop(backColor, 10, 7);
IntPtr handle = UnsafeNativeMethods.GetDCEx(new HandleRef(null,
UnsafeNativeMethods.GetDesktopWindow()), NativeMethods.NullHandleRef,
0x403);
IntPtr ptr2 = SafeNativeMethods.CreatePen(0, 1,
ColorTranslator.ToWin32(backColor));
int num2 = SafeNativeMethods.SetROP2(new HandleRef(null, handle),
nDrawMode);
IntPtr ptr3 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, UnsafeNativeMethods.GetStockObject(5)));
IntPtr ptr4 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, ptr2));
SafeNativeMethods.MoveToEx(new HandleRef(null, handle), start.X,
start.Y, null);
SafeNativeMethods.LineTo(new HandleRef(null, handle), end.X, end.Y);
SafeNativeMethods.SetROP2(new HandleRef(null, handle), num2);
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr3));
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr4));
SafeNativeMethods.DeleteObject(new HandleRef(null, ptr2));
UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new
HandleRef(null, handle));
}

And the Splitter control uses a similar approach to draw the splitter (GDI
function PatBlt).

If you're familiar with some other unmanaged language (VB6 or C++), you can
try call these functions in the exactly the same way to simulate the same
task you want to do in your project, and see if the machine still gets
hung. This way you may be able to narrow down the problem - to see if this
is .NET specific or it is in GDI.

The problem could also be caused by the video driver (I've seen cases where
app got hung/crash while doing certain graphic operations, and the problem
gone after upgrading/downgrading the video driver). Especially if this
problem only happens on a single machine or on machines with the same
hardware/driver configuration but not reproducable on other machines.

So could you let me know whether or not the problem is reproducable on all
Vista machines with different graphic cards/drivers? If you don't have
spare machines to test, you can also try on a virtual machine.

Waiting for more information.

Regards,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
It is not that simple of a WIN 32API call, there are a lot of other objects
involved, most of which are private classes.

I have tried to update the video card drivers, no help.
How could I prove it's a driver issue? Then at least I could submit a bug to
ATI.

I can not reproduce this issue on any other machine yet. Currently using a
laptop.

Toshiba L355D-S7901
ATI Radeon 3100
Driver:
4/22/2008
8.479.0.0

I tried the newer driver "9-5_vista64_win7_64_dd" , it failed also.

It had windows home premium, thought maybe it was a bad os image so now I
have installed Vista Ultimate.

Eric


"Jie Wang [MSFT]" said:
Hi Eric,

The DrawReversibleLine method simply calls Windows GDI APIs to have its
task done. Looks like this:

[UIPermission(SecurityAction.LinkDemand,
Window=UIPermissionWindow.AllWindows)]
public static void DrawReversibleLine(Point start, Point end, Color
backColor)
{
int nDrawMode = GetColorRop(backColor, 10, 7);
IntPtr handle = UnsafeNativeMethods.GetDCEx(new HandleRef(null,
UnsafeNativeMethods.GetDesktopWindow()), NativeMethods.NullHandleRef,
0x403);
IntPtr ptr2 = SafeNativeMethods.CreatePen(0, 1,
ColorTranslator.ToWin32(backColor));
int num2 = SafeNativeMethods.SetROP2(new HandleRef(null, handle),
nDrawMode);
IntPtr ptr3 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, UnsafeNativeMethods.GetStockObject(5)));
IntPtr ptr4 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, ptr2));
SafeNativeMethods.MoveToEx(new HandleRef(null, handle), start.X,
start.Y, null);
SafeNativeMethods.LineTo(new HandleRef(null, handle), end.X, end.Y);
SafeNativeMethods.SetROP2(new HandleRef(null, handle), num2);
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr3));
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr4));
SafeNativeMethods.DeleteObject(new HandleRef(null, ptr2));
UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new
HandleRef(null, handle));
}

And the Splitter control uses a similar approach to draw the splitter (GDI
function PatBlt).

If you're familiar with some other unmanaged language (VB6 or C++), you
can
try call these functions in the exactly the same way to simulate the same
task you want to do in your project, and see if the machine still gets
hung. This way you may be able to narrow down the problem - to see if this
is .NET specific or it is in GDI.

The problem could also be caused by the video driver (I've seen cases
where
app got hung/crash while doing certain graphic operations, and the problem
gone after upgrading/downgrading the video driver). Especially if this
problem only happens on a single machine or on machines with the same
hardware/driver configuration but not reproducable on other machines.

So could you let me know whether or not the problem is reproducable on all
Vista machines with different graphic cards/drivers? If you don't have
spare machines to test, you can also try on a virtual machine.

Waiting for more information.

Regards,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support
Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
It crashes on the SafeNativeMethods.MoveToEx(new HandleRef(null, handle),
start.X, start.Y, null);

I have a trace before every call, that is the only way I know. I have no
error message since it locks the whole system.



"Jie Wang [MSFT]" said:
Hi Eric,

The DrawReversibleLine method simply calls Windows GDI APIs to have its
task done. Looks like this:

[UIPermission(SecurityAction.LinkDemand,
Window=UIPermissionWindow.AllWindows)]
public static void DrawReversibleLine(Point start, Point end, Color
backColor)
{
int nDrawMode = GetColorRop(backColor, 10, 7);
IntPtr handle = UnsafeNativeMethods.GetDCEx(new HandleRef(null,
UnsafeNativeMethods.GetDesktopWindow()), NativeMethods.NullHandleRef,
0x403);
IntPtr ptr2 = SafeNativeMethods.CreatePen(0, 1,
ColorTranslator.ToWin32(backColor));
int num2 = SafeNativeMethods.SetROP2(new HandleRef(null, handle),
nDrawMode);
IntPtr ptr3 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, UnsafeNativeMethods.GetStockObject(5)));
IntPtr ptr4 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, ptr2));
SafeNativeMethods.MoveToEx(new HandleRef(null, handle), start.X,
start.Y, null);
SafeNativeMethods.LineTo(new HandleRef(null, handle), end.X, end.Y);
SafeNativeMethods.SetROP2(new HandleRef(null, handle), num2);
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr3));
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr4));
SafeNativeMethods.DeleteObject(new HandleRef(null, ptr2));
UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new
HandleRef(null, handle));
}

And the Splitter control uses a similar approach to draw the splitter (GDI
function PatBlt).

If you're familiar with some other unmanaged language (VB6 or C++), you
can
try call these functions in the exactly the same way to simulate the same
task you want to do in your project, and see if the machine still gets
hung. This way you may be able to narrow down the problem - to see if this
is .NET specific or it is in GDI.

The problem could also be caused by the video driver (I've seen cases
where
app got hung/crash while doing certain graphic operations, and the problem
gone after upgrading/downgrading the video driver). Especially if this
problem only happens on a single machine or on machines with the same
hardware/driver configuration but not reproducable on other machines.

So could you let me know whether or not the problem is reproducable on all
Vista machines with different graphic cards/drivers? If you don't have
spare machines to test, you can also try on a virtual machine.

Waiting for more information.

Regards,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support
Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
Hi Eric,

What are the coordinates you passed to the DrawReversibleLine?

After doing some research, I found it is known that the max delta
MoveTo(Ex) & LineTo can accept is 2^27, reaching or exceeding this number,
the DrawReversibleLine just silently fails on my machines (from XP, Vista
to 7), but never hang the machine.

Another way to narrow down the problem is to use the default VGA graphics
driver provided by Windows itself, then run the program, will that also
hang the machine?

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Yes I saw that also, I have bee watching the locations, they don't seem to
be the problem. It randomly crashes, also I can't reproduce this problem on
any XP machines. It's either a driver issue, a windows bug due to
threading/64 bit. This call seems to have a history of locking-up the OS. I
am running on a 64bit machine and OS, and also dual core AMD, I think that
could be an issue. I plan to try another Vista machine this week-end. I have
managed to reproduce .NET ControlPaint.DrawReversableLine and I get the same
problem.

Eric
 
Hi Eric,

Thank you for the update.

Since I can't create a repro on my side, all I can do is keep researching
and consulting with some internal resources. I will give you an update once
I found anything.

Besides, if you have a small project that can reproduce the hang, please
send it to me (my no-spam email remove online).

Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Eric,

I'm going to setup a machine and test your code.

I'll get back to you tomorrow.

Regards,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Eric,

I tried several configurations (including several desktops, laptops, VPC
and my own laptop which has an ATI Radeon X1400), but failed to reproduce
the problem. The method just worked fine.

I suggest you contact Microsoft CSS for support if you want the root cause
found, they can help you on the debug things which is beyond what the
newsgroup can do.

Thanks,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
I think you will need to use the same video card and drivers to reproduce...

or my Laptop: Toshiba L355D-S7901
ATI Radeon 3100

Driver:
ATI Technologies Inc.
4/22/2008
8.479.0.0

Eric
 
Hi Eric,

I'll try to find one with the same video card. However, here in newsgroup I
don't have the resources to request for some specific hardware for testing.
I also want to know what happens there but I just can't get across the
boundary. So I will ask if someone around me happens to have such a machine
I can borrow for testing, but not much hope there.

In this case, I suggest you contact Microsoft Customer Support Services
(CSS) (http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx) for
better support and help.

Best regards,

Jie Wang

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top