473,395 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Best way to detect cause of lockups

Hi,

We have a multi-threaded app, which has a windows form front end.

We think we have been pretty careful to ensure that nothing but the UI
thread alters controls on the form. But we've started experiencing lock ups.
Of course, there could be any one of a number of causes but we wonder if one
of our developers has been a little bit careless about using InvokeRequired
and BeginInvoke.

Are there any tools that can help detect this sort of thing? Some tool you
can run your app under and if a control is accessed outside of the UI thread
it pops up an error box? I guess I'm thinking along the lines of
BoundsChecker, but for C#.

Any suggestions gratefully received.

Thanks,

- Adam.

==============================
Ad*********@Omnibus.NOSPAMMYSPAMSPAM.co.uk
Mar 1 '07 #1
7 2785
I should add that I know that CLR 2.0 is much less tolerant and would
probably find this because we'd get an exception, but we're stuck with 1.1
for a while.

- Adam.
Mar 1 '07 #2
Hi,

"Adam Benson" <Ad*********@NOSPAMMYSPAM.omnibus.co.ukwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,
Are there any tools that can help detect this sort of thing? Some tool you
can run your app under and if a control is accessed outside of the UI
thread it pops up an error box? I guess I'm thinking along the lines of
BoundsChecker, but for C#.
I know of nothing like that, and I do not recall any other post in this
newsgroup about such a tool (and I've been aroudn for a while).

Debugging multithreaded apps is a PITA in my personal opinion. Try to
localize the best you can the possible source of the problem and check the
code.

Good luck with that.
--
Ignacio Machin
machin AT laceupsolutions com
Mar 1 '07 #3
"Adam Benson" <Ad*********@NOSPAMMYSPAM.omnibus.co.ukwrote in message
news:eO**************@TK2MSFTNGP04.phx.gbl...
>I should add that I know that CLR 2.0 is much less tolerant and would probably find this
because we'd get an exception, but we're stuck with 1.1 for a while.

- Adam.
All you can do is attach a debugger when it happens. Note that deadlocks due to cross-thread
calls are rare, deadlocks because of an inconsistent locking protocol are more likely the
cause.

Willy.


Mar 1 '07 #4
"Adam Benson" <Ad*********@NOSPAMMYSPAM.omnibus.co.ukwrote
We have a multi-threaded app, which has a windows form front end.

We think we have been pretty careful to ensure that nothing but the UI
thread alters controls on the form. But we've started experiencing lock
ups.
When the app is hung, attach a debugger (VS2005 works well), pull up the
Threads window, and start looking through all the threads. You can do this
with Remote Debugging as well, if that works better.

When you get to the point where you can see what threads are deadlocked,
hopefully it won't be too tough to debug from there. You other option is to
generate a MiniDump, and load your dump into WinDbg and Son of Strike.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins
Mar 1 '07 #5
Thanks all for the replies.

Guess I've just got to tough it out. One more question, if I may - I have
taken some process dumps and loaded up the dumps in winddbg using sos.dll,
and I would have expected, if it was a UI hang to find the UI thread in the
same state. But the UI thread is in a totally different call stack every
single time. And yet the app is totally unresponsive. You can resize it, but
the app's front end itself does not repaint.

Has anyone any idea about what may do that?
(We do have some COM objects in the app - showing video - could one of those
objects be producing this?)

If it was 2 deadlocked worker threads I'd expect the UI to still be
responsive. I'm totally confused about how it is the UI is totally
deadlocked but I don't find the UI thread in the same state twice, and we've
now got about 8 snap shots of this.

If no one has anything to add, thanks again for your responses.

- Adam.
=========
Mar 2 '07 #6
"Adam Benson" <Ad*********@NOSPAMMYSPAM.omnibus.co.ukwrote in message
news:OS****************@TK2MSFTNGP05.phx.gbl...
Thanks all for the replies.

Guess I've just got to tough it out. One more question, if I may - I have taken some
process dumps and loaded up the dumps in winddbg using sos.dll, and I would have expected,
if it was a UI hang to find the UI thread in the same state. But the UI thread is in a
totally different call stack every single time. And yet the app is totally unresponsive.
You can resize it, but the app's front end itself does not repaint.
That means that the UI thread is blocked, so it's unable to handle paint messages.
Has anyone any idea about what may do that?
(We do have some COM objects in the app - showing video - could one of those objects be
producing this?)
Are you sure the COM objects are marked "Apartment Threaded" and created on the UI thread?
If this is the case, are you aware that the UI thread doesn't process messages for the
duration of a COM call?
If it was 2 deadlocked worker threads I'd expect the UI to still be responsive.
Yep, unless the UI thread also waits on an object held by the worker threads.

I'm totally confused about how it is the UI is totally
deadlocked but I don't find the UI thread in the same state twice, and we've now got about
8 snap shots of this.
And what's the UI thread's call stack saying?

Willy.

Mar 2 '07 #7
Hi,

Please strike my last request.

Decided the best thing to do was open an MS support call.

Thanks again for the responses.

- Adam.
===========
Mar 8 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Petre Agenbag | last post by:
Hi List Been trying to help out with this problem on a SunOS5.8 box running 3.23.56 It experiences periodic lockups of mysql. It does not seem that this server has a my.cnf file for mysql,...
1
by: Jeje | last post by:
Hi, I'm trying to detect if an input field is visible or not in order to put the focus inside it (or else it cause th error : "Can't move the focus ot the control because it is invisible, not...
4
by: Frank Meng | last post by:
Hi. I am trying a csharp sample from http://www.codeproject.com/csharp/socketsincs.asp . (Sorry I didn't post all the source codes here, please get the codes from above link if you want to try)....
2
by: Bob | last post by:
I made a major .Net app deployment last month and got some troubling user feedback - some users say that since they started running the app, all their other applications a running noticeably...
1
by: astroboy | last post by:
How do I detect which object cause memory leak???? Thx
4
by: Dst | last post by:
This is what i'm trying to do: I'm porting a windows app to a web app. I have a webform which will edit some data stored in a database. The data needs to be locked in the database, while editing....
14
by: ThunderMusic | last post by:
Hi, I want to detect in my C# app (can use iterop) if the workstation is locked. I've seen on the web people saying it's impossible except by looking if the Screensaver process is running. There...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all mister, Which is THE BEST WAY IN THE WORLD AROUND for: 1. detect Network
3
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all mister, Which is THE BEST WAY IN THE WORLD AROUND for: 1. detect Network
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.