Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application Freezing

Status
Not open for further replies.

snuv

Programmer
Oct 30, 2001
751
GB
We have a modular application that freezes intermittently.

The product doesn't use threading so nothing is being locked out.
The finalize methods have been disabled or removed

There seems to be plenty of free processor time when the app is frozen.

After a few seconds,the app carries on

Can anyone suggest anything else that might cause these random freezes?

Cheers
Snuv

"If it could have gone wrong earlier and it didn't, it ultimately would have been beneficial for it to have." : Murphy's Ultimate Corollary
 
If this occurs during execution of a SQL transaction it could be caused by locks on the database i.e. the SQL process is waiting for another process to complete on the database side - if the lock is cleared before the connection times-out your process would continue as if nothing had happened. So you'd see this as temporary freezing.

It's a possibility - depends on your app and what's happening when it freezes.
 
We can have 90% free CPU and the GUI freezes for 10-20 seconds which is really irritating for users

We thought of SQL locks but it doesn't appear to be related as we have a separate program running our SQL and it isn't using many clock cycles either.

We aren't doing any intense processing; E.G. The application can freeze when we are adding text to a textbox.
I'm not saying that the freeze is related to adding the text, it's just an example of when it can happen

Likewise we aren't doing any IO

Thanks for taking the time to post
If we come up with a reason, I will add it

Cheers
Snuv


"If it could have gone wrong earlier and it didn't, it ultimately would have been beneficial for it to have." : Murphy's Ultimate Corollary
 
He Snuv, it really sounds like an IO issue. If you are hitting a database at all, that is IO and will have a delay. Since you are hitting the database from the primary thread, and the primary thread is responsible for updating the GUI, the application will appear to freeze even though it isn't using much of the processor.

Post some code for what ever sub the GUI locks up in, or check out the FAQs here on the site for info about threading.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 

As a quick test, you can also drop in Application.DoEvents() into various points in the code. You can then find out quite quickly the part of the code that is responsible for the hangup.

The Application.DoEvents merely tells the app to process any pending events before proceeding further.
 
Application.DoEvents wont help with I/O freezes. Application.DoEvents will work when you have processor intensive sequential code. (although its still a crutch)

The problem with I/O code is that the process hangs on a single line, so the DoEvents will only fire before and after that line, but if that line take 3 minutes to complete, the UI will freeze.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 

Agreed, but if Snuv can identify the actual line of code then perhaps something can be done with that to speed things up.

The Application.DoEvents will prevent the GUI from hanging so you can see the state of any messages etc. at the point of the hang. Its not a solution, but I find a quick way of isolating the actual code, expecially when the GUI goes into a whiteout.
 
It hangs as though a thread in the app is being locked out but we haven't got a threaded application

We cant recreate the problem reliably, some users get it, other dont. It happens in different places in the gui so isolating a specific line is tricky.

Its certainly not doing anything intensive or any IO when it has happened on my machine

It may happen when the software is doing intense number crunching as well, but we freeze the gui anyway so we wouldn't notice.

Are there were any known issues with the dotnet framework that might cause it

cheers
Snuv

"If it could have gone wrong earlier and it didn't, it ultimately would have been beneficial for it to have." : Murphy's Ultimate Corollary
 
If you are not processing anything, and there is no I/O, what does your application do?

I/O is:
Accepting or displaying info to the user
Connecting to or retrieving data from a database
Reading from a text file
Pulling/Posting data to the web
FTPing files
etc...

Any form of input or output. And any form of input or output that has a wait will cause the GUI to freeze.

Also, all applications are threaded, by default, all applications have 1 thread. That one thread is responsible for drawing and updating the GUI along with executing all of your code. By moving your code off of the primary thread it allows the primary thread to concentrate on keeping the GUI up to date.

If you are having intermittent locks when code is not executing, I would look at the machine and make sure that it isn't running any background intensive tasks (spyware/ad-ware, viruses, etc..) And if you have McAfee antivirus, try patching it.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
The only thing the app is doing is waiting for user input and the gui has frozen so it isn't actually doing anything.

I stand corrected about the threads.
I should have said that our app is single threaded apart from any child threads that the framework may spawn.
Does the dotnet framework spawn threads behind the scenes to handle events or anything else?

There are plenty of free clock cycles but we are running mcafee. Could Mcafee cause the suspension while it scans something?

I do appreciate your time in thinking about and responding to this
Cheers
Snuv

You missed moon of Jupiter and daughter of Inachus in greek mythology :)



"If it could have gone wrong earlier and it didn't, it ultimately would have been beneficial for it to have." : Murphy's Ultimate Corollary
 

I had a very similar problem to this one time. I had a an app which would lock up on some machines but not on others. The problem was subtle and was caused by an event triggering two subs. The two subs would then intefere with one another retriggering the event and the whole mess would start over again. For whatever reason, this was dependent on the machine being used. So check to see whether you have this situation in your code.

Only other thing I can suggest is to make the app produce a log file, reporting which sub or function it is currently in. You could also add the time too. When it hangs look at the log and see if a pattern shows up.

Failing that, shut down any other apps/services running at the same time until you find the smoking gun.
 
Stackdump

That sounds like a possibilty

Any clues on how you tracked down the events/subs in question

Cheers
Snuv

"If it could have gone wrong earlier and it didn't, it ultimately would have been beneficial for it to have." : Murphy's Ultimate Corollary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top