|
|
Home » U++ Library support » TopWindow&PopUp, TrayIcon » Freezing bare application on Windows XP
Freezing bare application on Windows XP [message #24086] |
Sat, 26 December 2009 10:05  |
qapko
Messages: 55 Registered: October 2007 Location: Slovakia
|
Member |
|
|
Hello,
I've discovered one issue in method Ctrl::GuiSleep0 (used by TopWindow::Run()). Namely, Upp application may freeze on line ExitLoopEvent().Wait() just after starting it on Windows XP. I've seen it by providing debug logging to the sources of Upp. Then I experimented and removed the line and the bug dissapeared. I don't see deeply in the internals of event loop of Upp, so I am not sure what the line is doing here at all. Is there anybody, who understands the issue and may provide some fix? The problem is appearing with my regular Upp applications also. It's sad, that Upp (or something below it?) has such an instability in the core of itself.
I'm attaching my testsuite that I've created to make the problem more frequent to see.
I also noticed that Ctrl::ProcessEvent and Ctrl::ProcessEvents have no GuiLock at the start of the methods in Windows version, but X11 version have ones. Is it OK? Can't it freeze the application while running? One of my customers is complaining that GUI of the Upp application, that we are developing for him, is freezeng occasionaly, but he can see that all the threads of the application behind GUI work fine in the situation (but the threads are written in Python, not in Upp).
I'm prepared to test the issue further with some instructions from you.
Thank you for your help.
Have a happy new year with this outstanding framework! 
Gabi
-
Attachment: kmedis.zip
(Size: 1.68KB, Downloaded 427 times)
|
|
|
Re: Freezing bare application on Windows XP [message #24089 is a reply to message #24086] |
Sat, 26 December 2009 14:46   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
qapko wrote on Sat, 26 December 2009 04:05 | Hello,
I've discovered one issue in method Ctrl::GuiSleep0 (used by TopWindow::Run()). Namely, Upp application may freeze on line ExitLoopEvent().Wait() just after starting it on Windows XP. I've seen it by providing debug logging to the sources of Upp. Then I experimented and removed the line and the bug dissapeared. I don't see deeply in the internals of event loop of Upp, so I am not sure what the line is doing here at all. Is there anybody, who understands the issue and may provide some fix? The problem is appearing with my regular Upp applications also. It's sad, that Upp (or something below it?) has such an instability in the core of itself.
|
Unfortunately, I am not able to reproduce the bug nor I ever experienced it.... And really never encountered the issue in practive and I would say we really mainaint a lot of U++ apps... The only possible explanation is that it is somewhat connected with that initial timer call, which is a bit unusuall - but I still see no reason why it should mess the code.
Explanation of situation: There is some weird "OverWatchThread" in U++, which is basically only meant to patch exiting the application, as we had some weird issues there - namely, Windows displayed "Close" tooltip 2-3 seconds after you have closed the application with top-right corner X icon.
Digging into the issue, I have found that Win32 simply expects the appliaction to recieve WM_QUIT message as the only way to exit. Unfortunately, that is not really compatible with U++ way, where we just quit by exiting GUI_APP_MAIN. That is why we have the OverWatchThread - it is there only to "wait" for WM_QUIT message so that Win32 things everything is OK. Note that the main thread send WM_USER to this thread only to make it invoke "PostQuitMessage(0);".
This thread uses ExitEventLoop Event to communicate with the main GUI thread. It sets the Event twice - first time to announce that OverWatchTread is started and running, second time to announce that the application is exiting.
For even other reasons, namely initialisaton of .ocx (you cannot start a new thread in DllMain), Tom has moved initialisation of this thread to GuiSleep.
Just staring at the code, I soo no real reason why it should not work. Simply, there are no other complex things in OverWatchThread startup - it should just create an invisible window and set the event.
In any case, please activate ELOGs - line 14 of the file and send the output .log.
Quote: |
I also noticed that Ctrl::ProcessEvent and Ctrl::ProcessEvents have no GuiLock at the start of the methods in Windows version, but X11 version have ones. Is it OK? Can't it freeze the application while running? One of my customers is complaining that GUI of the Upp application, that we are developing for him, is freezeng occasionaly, but he can see that all the threads of the application behind GUI work fine in the situation (but the threads are written in Python, not in Upp).
|
Should be ok. Maybe there are uncessarry GuiLocks in some cases, but they are suspended by LeaveGMutexAll(); anyway.
Mirek
|
|
|
|
|
Re: Freezing bare application on Windows XP [message #24097 is a reply to message #24086] |
Sat, 26 December 2009 21:15   |
qapko
Messages: 55 Registered: October 2007 Location: Slovakia
|
Member |
|
|
Yes,
A1 and B1 are from running the application without crashing or freezing. All As are from runs with GetSysTime in ELOGs. All Bs are from runs without GetSysTime in ELOGs. Some of them are with and some without SetTimeCallback in Kmedis contructor, which proves, that calling SetTimeCallback in Kmedis constructor has no effect on the bug.
In Bs the application hangs apparently on ExitLoopEvent().Wait() line in GuiSleep0(). I can prove it by putting RLOG before and after the line.
Gabi
[Updated on: Sat, 26 December 2009 21:36] Report message to a moderator
|
|
|
Re: Freezing bare application on Windows XP [message #24099 is a reply to message #24097] |
Sat, 26 December 2009 21:40   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Well, first partial finding:
The cause of crashing for GetSysTime is really stupid - in single threaded mode, you cannot call any U++ routine in non-main thread and ELOG does exactly that.... (in OverWatchThread).
Note: Otherwise, OverWatchThread is carefully designed not to call anything that would have this problem - it only calls win32 API which is MT safe.
BTW, have you tried this app with MT flag (it would fix GetSysTime problem).
(I have reproduced GetSysTime problem, but nothing else so far).
If you are getting consistent crashes, maybe one thing to try is to replace Event with Semaphore (or StaticSemaphore)... (Just replace Set with Release....).
BTW, you have not posted details of your compiler / system yet...
(I am trying to reproduce the problem in WinXP with MSC9).
Mirek
[Updated on: Sat, 26 December 2009 21:42] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Apr 20 18:25:45 CEST 2025
Total time taken to generate the page: 0.03008 seconds
|
|
|