0

This is on an iMac (late 2015) running MacOS Catalina. All energy saving options are off.

I have noticed this with several long-running processes and so I made a simple example.

I ran

while true; do date; sleep 60; done

around 11 am and let the screen lock. After a few hours I come back and check on it. Everything is fine for about an hour and a half, i.e. I do get one line per minute and then

Mon Feb  6 12:32:39 CET 2023
Mon Feb  6 12:33:39 CET 2023
Mon Feb  6 12:41:33 CET 2023
Mon Feb  6 12:43:08 CET 2023
Mon Feb  6 12:52:57 CET 2023
Mon Feb  6 13:28:00 CET 2023

after which it goes back to normal for about half an hour and then starts being erratic again.

Experience shows with other long running processes that the times this happens are fairly random.

Ideas on how to avoid this? I want my processes to run normally. Thanks.

gbohus
  • 11
  • 3
  • Are you asking a programming question of how to keep the machine awake and processing long task? Perhaps https://stackoverflow.com/q/5596319/1271826. Or are you just looking for a tool, like [Amphetimine](https://apps.apple.com/us/app/amphetamine/id937984704?mt=12), that does this for you? – Rob Feb 06 '23 at 16:58
  • I will give Amphetamine a try. (Your first link is very Objective-C specific and most of my stuff is in Python.) If it is indeed going to sleep, why does it wake up and continue working? Anyway, thanks, I'll try it. – gbohus Feb 07 '23 at 17:16
  • As I understand it, macOS [power nap](https://support.apple.com/guide/mac-help/what-is-power-nap-mh40773/mac) will, in the absence of user interaction with the UI, put the machine asleep, but will periodically wake up, run anything that was scheduled to run in the intervening period of time, before napping again. Re [TN QA1340](https://developer.apple.com/library/archive/qa/qa1340/), yes, this is an API accessed from, in practical terms, either Swift or Objective-C). – Rob Feb 07 '23 at 23:19

1 Answers1

0

As @Rob mentioned in his comment yesterday, turning off power nap in Energy settings seems to solve this problem. (I had a chance to test it for several periods now, including overnight.)

Thanks!

gbohus
  • 11
  • 3