-
Freezing Issue
This is probably a tough question to answer with out any code, but in case someone came across something similar to this in the past ill ask anyway.
i have a touch screen kiosk application that runs all the time on a computer. the user has no way to close it or open any other programs while it is running. but it seems like around 2 hours of inactivity, when you try to click something on the screen, the screen saver turns off(like it should) and the application doesnt draw itself back correctly. its all ghostly and such. but only after a long period of inactivity(like 2 hours or more) the wierd thing is that you can still press the windows key, and log off the computer and run other applications.
i know its tough to debug without any code but just wondering if anyone has had any freezing issues and what they possibly did to fix them?
thanks to anyone with any input, i appreciate it
-
Re: Freezing Issue
What OS and version? Is it fully updated and patched? Have you tried it with other screensavers to determine if its a screensaver issue?
-
Re: Freezing Issue
One thing I can imagine is that once the screen saver goes, the app will lose focus.
-
Re: Freezing Issue
xp pro,service pack 2. and now it seems as if it will still freeze even when the screen saver is disabled. but still only after it has been inactive for a long time. the form that is sits at for a long time and freezes at is just a login form. and it doesnt have any continuous processes or anything occurring. we watched the memory in the task manager and it doesn't seem to grow at all while it is not in use.
-
Re: Freezing Issue
Can you make a test app with a basic form and thats all and see if it does the same thing? Also test other programs to see if when they are left open for that time will they also do the same issue. It may be a system issue and not code.
-
Re: Freezing Issue
Does your program access a database or have objects that need to "live forever"? I've had some issues with "My application, after being left running for 8 hours doing nothing, suddenly freezes, crashes or stops working when you start using it again".
The trick I found is:
1) Never leave database connections open (create them, open them, use them, close them, dispose them)
2) For objects that need to live forever, put this in their class:
Code:
Public Function InitializeLifetimeService() As Object
Return Nothing
End Function
I've been told the garbage collection in .NET can be pretty aggressive and it has a habit of disposing things you happen to have sitting open but haven't used in a long time. That line of code should tell it to ignore your object and has saved my program from similar problems.
-
Re: Freezing Issue
i am going to try what you posted Jenner. i think you may be on to something here. i appreciate everyones input, and ill update with any progress(or lack of:))
-
Re: Freezing Issue
well i tried that Function, but it didnt seem to have any effect. i went back to a previous build and i do not have the problem. the biggest difference is that the new build(the broken one) uses the backgroundworker and the old build(the one that doesnt freeze) uses System.Threading.
the background worker is created on Form1 which Form1 is the form that is the login form that will stay open for long periods of time and its the form keeps getting frozen. any ideas anyone??
RobDogg: i tried other apps too and the problem is not occurring so it is only occurring with the current build of the app, which is using the background worker..
thanks everyone
-
Re: Freezing Issue
At least you narrowed it down to that. Honestly, I never liked the funky "BackgroundWorker" junk they put in. I never saw a problem with making threads via System.Threading and BackgroundWorker has caused me nothing but headaches in the past.
Personally, I don't use them anymore and as far as I know, aside from introducing a new programmer to simple threading, have no advantages over making threads via System.Threading.
-
Re: Freezing Issue
yeah, i know what your saying. unfortunately, my boss was told by his "VB Guru" that background workers are 100 times better than the old Threading, so he told me to change.(even tho it was working fine with the old way) maybe this will change his mind about it... thanks for your help
-
Re: Freezing Issue
I have no problems using the background worker. It is usually just not used correctly. All it does is wrap up threading operations so you can add multithreading without having to deal with marshalling info across threads and worrying about invoking objects on other threads.
As long as you follow the basic rules of not touching any non thread safe objects from the main thread in the DoWork routine, and ONLY touching the UI thread for reporting background worker status via the ProgressChanged and RunWorkerCompleted events, you shouldn't have any problems.
-
Re: Freezing Issue
well thats the wierd thing about it, the background worker works how it should when its being used. the only problem i have is when the system is idle that the app freezes, and it seems(it could be a coincidence,ill have to test more) but since i removed the BG worker, the app doesnt freeze anymore. the wierdest thing is that the app freezes after the app and computer has been sitting idle for over an hour or so, so no processes are even occurring. its just the form sitting there doing nothing...
-
Re: Freezing Issue
Does the background worker's RunWorkerCompleted event ever fire after you call the RunWorkerAsync method and the DoWork routine finishes?
-
Re: Freezing Issue
yes, the background worker RunWorkerCompleted event occurs everytime after the DoWork event finishes. but it just seems as though after an hour or so of being idle something still disposes of the Login form for some reason...but i have no idea what would cause anything to happen at all when the form isnt in use by a user because the form doesnt have any events that occur without the users input