Possible reasons application is locking up?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is just a general question. I have an application that I developed for a Pocket PC v2003 that periodically locks up at random points in the application. Since the locking up occurs at random places it is very hard to debug. I was wondering if anybody had any input on some common things that may cause this? The application is a data collection application that has many forms with bound controls. Could it be to many controls? Users tapping things to quickly? To many datatables? I'm not sure how to get to the bottom of it? Anybody had this experience

Thank
 
Mike,

Are you using multithreadiing? That's a common source of lockups.
--
Ginny Caughey
..Net Compact Framework MVP

Mike said:
This is just a general question. I have an application that I developed
for a Pocket PC v2003 that periodically locks up at random points in the
application. Since the locking up occurs at random places it is very hard
to debug. I was wondering if anybody had any input on some common things
that may cause this? The application is a data collection application that
has many forms with bound controls. Could it be to many controls? Users
tapping things to quickly? To many datatables? I'm not sure how to get to
the bottom of it? Anybody had this experience?
 
No, no multithreading. It's a pretty straight forward application. Not a lot of "funny stuff" going on which is what makes it all the more confusing. If I had to take a guess it would be that all my controls are bound to a datatable. Most of the lockups happen when they click a drop down box. But it is no particular dropdown and it is not limited to the dropdowns. Even if that is the problem, I wouldnt know how to go about fixing it as it can be used for serveral hours before it happens.
Arggg

Mike
 
Mike,

Are you sure about multithreading? Are you using any asynchronous methods
with callbacks?
Perhaps, some timers? There might be another thread involved even if you
did not started it.
And if you update DataTable bound to a control from another thread, it will
lock up eventually.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Possible reasons application is locking up?
thread-index: AcQn9eqWHEEX1Ni3RLuwZo9ZMAytWQ==
X-WN-Post: microsoft.public.dotnet.framework.compactframework
From: "=?Utf-8?B?TWlrZQ==?=" <[email protected]>
References: <[email protected]>
Subject: Re: Possible reasons application is locking up?
Date: Wed, 21 Apr 2004 16:11:02 -0700
Lines: 4
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:51482
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

No, no multithreading. It's a pretty straight forward application. Not
a lot of "funny stuff" going on which is what makes it all the more
confusing. If I had to take a guess it would be that all my controls are
bound to a datatable. Most of the lockups happen when they click a drop
down box. But it is no particular dropdown and it is not limited to the
dropdowns. Even if that is the problem, I wouldnt know how to go about
fixing it as it can be used for serveral hours before it happens.
Arggg.

Mike
 
Ilya,

Thanks for your input. You might have a point. To be honest with you, I wasnt exactly sure what Ginny meant by multithreading (and thus the reason I assumed I wasnt doing it!). But, I am in fact sometimes updating datatables other than the immediatly bound datatable. Do you think that could be the issue? However, I am just updating a field here or there and at the time I am updating the fields (outside the current thread) the form with the bound controls isnt open. I would think that the application would lock up when I am actually updating the datatables though and that doesnt appear to be the case

I'm not sure about the asynchronous methods with callbacks as I'm not sure what that is? :(
 
No, that should not be a problem. You can do that from the same thread
(i.e. in control's events).

Let's figure out if you do use another thread somehow...

Are you using System.Timers.Timer? It fires events on another thread...

Anything with BeginXXXXX()/EndXXXXX() (like
System.Net.Sockets.TcpClient.BeginConnect()/EndConnect()?

That would be the asynchronous methods - the kind which doing something you
need in background while you can continue with your code without waiting
for completion.
As soon as this background method is done, it will fire event to notify you
and, guess what, this event will be on another thread.
Any tracees of IAsyncResult in your code (also a sign of asynchronous
methods)?

How about 3rd party objects with events?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Possible reasons application is locking up?
thread-index: AcQn/7IY6ABxCZy+T0m9jKCQw2pegQ==
X-WN-Post: microsoft.public.dotnet.framework.compactframework
From: "=?Utf-8?B?TWlrZQ==?=" <[email protected]>
References: <[email protected]>
<eWUqr8#[email protected]>
Subject: Re: Possible reasons application is locking up?
Date: Wed, 21 Apr 2004 17:21:03 -0700
Lines: 5
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:51485
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Ilya,

Thanks for your input. You might have a point. To be honest with you, I
wasnt exactly sure what Ginny meant by multithreading (and thus the reason
I assumed I wasnt doing it!). But, I am in fact sometimes updating
datatables other than the immediatly bound datatable. Do you think that
could be the issue? However, I am just updating a field here or there and
at the time I am updating the fields (outside the current thread) the form
with the bound controls isnt open. I would think that the application
would lock up when I am actually updating the datatables though and that
doesnt appear to be the case?

I'm not sure about the asynchronous methods with callbacks as I'm not sure
what that is? :(
 
Ilya,

Thanks for the suggestions. Lets see, I do have a timer in the app but it is just for displaying a splash screen and then I'm done with that. I do have a few 3rd party controls with events, but they are some of the more common ones. OpenNet SDF, Intelliprog DateTimePicker and InTheHand (dont know if your familiar). Again, I would think that if any of these were the problem that the locking up would happen when I'm doing something related to them but that doesnt seem to be the case

To complicate matters, it appears as if I may be losing some data if the app locks up and the user has to do a soft reset. This also makes no sense to me as if a record gets written to a data table via 'DataAdapter.Udpate' shouldnt it be there permantly whether or not I soft reset the device

Thank

Mike
 
Well, we probably can eliminate DateTimePicker as it's a UI control and it
should work in a UI thread.

InTheHand (I assume you're using CE DB provider?) is probably also low risk.

Now, what are you using from SDF? I'm pretty sure some classes in SDF can
fire events on another threads.
'Player' class is a good candidate for that.

The best way to go is to actually check if event is fired on another
thread. Code below will do it for you.

Just call TDebug.Initialize() from UI thread (say, from
InitializeComponent()) and insert calls to TDebug.Check() into suspicious
event handlers (i.e. none UI components).
You will get an exception if event is on another thread. If your project is
in VB, compile this code as a separate C# project, get a DLL and reference
it in your VB project.
Note: there's a value you might have to change if you running on device
other than ARM. All PPC2002 and 2003 are ARM based.

As to data storage, are you sure data is actually saved? Which data storage
are you using?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

using System;

namespace ThreadDebug
{

public class TDebug
{
const uint PUserKData = 0xFFFFC800; // Change to 0x00005800 if not ARM
CPU (i.e. emulator).
const uint SYSHANDLE_OFFSET = 0x004;
const uint SH_CURTHREAD = 1;

static uint baseThreadId = 0;

public static void Initialize()
{
baseThreadId = GetCurrentThreadId();
}

public static void Check()
{
if (0 == baseThreadId)
{
throw new Exception("You have to call Initialize() before calling
Check()");
}

if (baseThreadId != GetCurrentThreadId())
{
throw new Exception("Another thread detected!");
}
}

static unsafe uint GetCurrentThreadId()
{
return ((uint*)(PUserKData+SYSHANDLE_OFFSET))[SH_CURTHREAD];
}
}
}


--------------------
Thread-Topic: Possible reasons application is locking up?
thread-index: AcQoQKf3YcHQuSYsQMq5zrIneZ1lzA==
X-WN-Post: microsoft.public.dotnet.framework.compactframework
From: "=?Utf-8?B?TWlrZQ==?=" <[email protected]>
References: <[email protected]>
<eWUqr8#[email protected]>
<[email protected]>
<[email protected]>
Subject: Re: Possible reasons application is locking up?
Date: Thu, 22 Apr 2004 01:06:03 -0700
Lines: 9
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:51500
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Ilya,

Thanks for the suggestions. Lets see, I do have a timer in the app but it
is just for displaying a splash screen and then I'm done with that. I do
have a few 3rd party controls with events, but they are some of the more
common ones. OpenNet SDF, Intelliprog DateTimePicker and InTheHand (dont
know if your familiar). Again, I would think that if any of these were the
problem that the locking up would happen when I'm doing something related
to them but that doesnt seem to be the case.

To complicate matters, it appears as if I may be losing some data if the
app locks up and the user has to do a soft reset. This also makes no sense
to me as if a record gets written to a data table via 'DataAdapter.Udpate'
shouldnt it be there permantly whether or not I soft reset the device?

Thanks

Mike
 
Back
Top