G
Guest
I've spent the last couple of weeks trying to get to the bottom of a thread
that hangs. We have a form-based application that updates some data once per
minute using a System.Threading.Timer. Inside the spawned thread, we are
using Control.Invoke to call methods on home grown objects. After running
for anywhere from several hours to a day, we see the data update thread hang
at one of these Control.Invoke calls. Using WinDbg, we have determined it is
not a deadlock because we can see that only one thread has a lock. Further,
that thread appears to be stuck on a WaitOneNative call that apparently
happens as part of the Invoke process. It is important to note that we have
seen the Invoke call hang when calling empty (noop) methods on our objects as
well as methods that contain code. Here is a stack trace of the offending
thread:
0x039ecb5c 0x7c90eb94 [FRAME: ECallMethodFrame] [DEFAULT] Boolean
System.Threading.WaitHandle.WaitOneNative(I,UI4,Boolean)
0x039ecb70 0x799ef0b7 [DEFAULT] [hasThis] Boolean
System.Threading.WaitHandle.WaitOne()
0x039ecba4 0x7b853fc4 [DEFAULT] [hasThis] Object
System.Windows.Forms.Control.MarshaledInvoke(Class
System.Windows.Forms.Control,Class System.Delegate,SZArray Object,Boolean)
0x039ecc48 0x7b881b19 [DEFAULT] [hasThis] Object
System.Windows.Forms.Control.Invoke(Class System.Delegate,SZArray Object)
0x039ecc58 0x7b881ae2 [DEFAULT] [hasThis] Object
System.Windows.Forms.Control.Invoke(Class System.Delegate)
0x039ecc5c 0x08fa5cad [DEFAULT] [hasThis] Void
Manager.Dashboard.UpdateWxData(Object)
at [+0x5c55] [+0x2217] Dashboard.cs:2289
0x039eeed4 0x02cb335d [DEFAULT] [hasThis] Void
Manager.Dashboard.timerWx_Tick(Object)
at [+0x18d] [+0xc6] Dashboard.cs:16707566
that hangs. We have a form-based application that updates some data once per
minute using a System.Threading.Timer. Inside the spawned thread, we are
using Control.Invoke to call methods on home grown objects. After running
for anywhere from several hours to a day, we see the data update thread hang
at one of these Control.Invoke calls. Using WinDbg, we have determined it is
not a deadlock because we can see that only one thread has a lock. Further,
that thread appears to be stuck on a WaitOneNative call that apparently
happens as part of the Invoke process. It is important to note that we have
seen the Invoke call hang when calling empty (noop) methods on our objects as
well as methods that contain code. Here is a stack trace of the offending
thread:
0x039ecb5c 0x7c90eb94 [FRAME: ECallMethodFrame] [DEFAULT] Boolean
System.Threading.WaitHandle.WaitOneNative(I,UI4,Boolean)
0x039ecb70 0x799ef0b7 [DEFAULT] [hasThis] Boolean
System.Threading.WaitHandle.WaitOne()
0x039ecba4 0x7b853fc4 [DEFAULT] [hasThis] Object
System.Windows.Forms.Control.MarshaledInvoke(Class
System.Windows.Forms.Control,Class System.Delegate,SZArray Object,Boolean)
0x039ecc48 0x7b881b19 [DEFAULT] [hasThis] Object
System.Windows.Forms.Control.Invoke(Class System.Delegate,SZArray Object)
0x039ecc58 0x7b881ae2 [DEFAULT] [hasThis] Object
System.Windows.Forms.Control.Invoke(Class System.Delegate)
0x039ecc5c 0x08fa5cad [DEFAULT] [hasThis] Void
Manager.Dashboard.UpdateWxData(Object)
at [+0x5c55] [+0x2217] Dashboard.cs:2289
0x039eeed4 0x02cb335d [DEFAULT] [hasThis] Void
Manager.Dashboard.timerWx_Tick(Object)
at [+0x18d] [+0xc6] Dashboard.cs:16707566