Recent

Author Topic: Update detection  (Read 298 times)

user5

  • Full Member
  • ***
  • Posts: 226
Update detection
« on: April 16, 2019, 04:16:59 am »
    Recently I was running a Lazarus program when the animated blue pause circle appeared and the program seemed to be frozen so after a long while (+-30 sec.) I ended it with the Task Manager.
    Now I think an update may have paused the program which would have automatically resumed after the update was done. Is this possible?
    The Windows Event Viewer log reports did show an update occurring when the program was paused but listed no unresponsive program problems so as far as Windows was concerned no error ever occurred. The large procedure being run has never in the past showed the blue pause circle before though some other large procedures have showed the circle. It would help if the program could alert the user with an appropriate message in this case.
    What do I need here? Would it be a combination of update detection and pause dectection?
    Thanks.

Mr.Madguy

  • Sr. Member
  • ****
  • Posts: 431
Re: Update detection
« Reply #1 on: April 16, 2019, 06:00:31 am »
Unfortunately it's known Windows problem. Microsoft's tasks have higher priority, that user's tasks, so sometimes, if you have weak computer (especially with not enough cores), update process can cause foreground programs hanging. It's better now, but I remember, how painful updates were back in Vista times. If Windows was updating, you couldn't do anything with your computer, even if your task was urgent.
Many major changes - Version has been changed to 3.0!
Crazy unit testing
Lack of multiple inheritance turns it into abomination.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6918
Re: Update detection
« Reply #2 on: April 16, 2019, 01:25:06 pm »
It happens mainly if your primary disc is a HDD (not SSD), and the program was accessing disk at the time it hung.

Windows update often eats up all disk bandwidth (and contrary to Mr. Madguy, IMHO that only has gotten worse since Vista), and also quite some CPU (noticable e.g. on dual core core2 generation, less noticable on even 4 year old Core 2000 and 3000 series)

 

user5

  • Full Member
  • ***
  • Posts: 226
Re: Update detection
« Reply #3 on: April 16, 2019, 01:52:02 pm »
    Thank you for your replies. They were very interesting. I know that updates can cause problems but that's about all I know about it.
    I could rig up something with a timer that might detect a pause but I'm not sure about that. This problem is very rare so I guess that I'll just have the program flash a message which alerts the user about this potential situation.
    Thanks again.
   

Mr.Madguy

  • Sr. Member
  • ****
  • Posts: 431
Re: Update detection
« Reply #4 on: April 16, 2019, 02:38:52 pm »
It happens mainly if your primary disc is a HDD (not SSD), and the program was accessing disk at the time it hung.

Windows update often eats up all disk bandwidth (and contrary to Mr. Madguy, IMHO that only has gotten worse since Vista), and also quite some CPU (noticable e.g. on dual core core2 generation, less noticable on even 4 year old Core 2000 and 3000 series)
Unfortunately I can't compare them directly. I have several Intel Celeron 575 with 512Mb RAM and Core 2 Duo P8400 with 1Gb RAM notebooks with Vista installed. I don't have data about their hard drives, but they're standard 75Gb ones. These ones just hang, when update happens. But even on relatively modern computers with Intel Core i7-4770 and 16Gb RAM with Windows 7 or newer installed I can sense problems, when serious updates happen. Even sound stuttering can occur sometimes.

I don't know, if program can detect such problems. Cuz it's threads can simply be suspended at that moment.
Many major changes - Version has been changed to 3.0!
Crazy unit testing
Lack of multiple inheritance turns it into abomination.

mr-highball

  • New member
  • *
  • Posts: 42
Re: Update detection
« Reply #5 on: April 16, 2019, 03:43:37 pm »
Well, I don't have code that "detects" updates are running, but throughout your program execution you can do this, which tells windows "hold off"
Code: Pascal  [Select]
  1. uses
  2.   JwaWindows; //constants listed below
  3. ...
  4.  
  5. //call this on a timer somewhere in your code
  6. SetThreadExecutionState(ES_CONTINUOUS OR ES_SYSTEM_REQUIRED OR DWORD($00000040));
  7.  
-Highball