0

Over the past month or two the display on my old iMac 27-inch ("late 2009", running High Sierra 10.13.6) would randomly and suddenly go to sleep (sudden dead black) while in use (while typing, mousing, scrolling, etc.), but only about once a week or even less.

The first time I thought it had crashed (having the display go dead black while typing is very disconcerting) and I power-cycled it. The second time I realized the system was still running, and I logged in remotely with SSH to find everything "normal". I finally realized I could simply wake the display again with Control-Shift-Eject and then wiggling the cursor or hitting another key.

These past few days it started doing this very frequently -- every few minutes, or even more often for periods.

At first I thought it might be a software bug as it seemed to only happen when using the browser (perhaps a GPU bug).

Then, because it seemed OK for a short while after being idle for an hour or more, I thought it might be something to do with overheating, and I played with fan speeds (to the great annoyance of my ears). At first this seemed to make some difference, but I never really could make any strong correlation.

But then I realized it was probably being put to sleep under software control as apps were fully refreshing their windows upon waking the display (just as they do when returning from the screen saver, for example).

Finally I tried changing the Energy Saver settings to "Never" let the display go to sleep. This seems to have worked!

Now I've also quieted the fans, and so far (an hour or two of constant use) I have not had the screen suddenly go black since.

Does anyone have any deep understanding of how exactly the system controls display sleep, and whether or not there's any way to see logging of the events controlling display sleep?

1
  • Try running caffeinate -d to keep the display awake. – MarkHu Dec 18 '20 at 19:53
1

You may have a Hot Corner checked. if your mouse touched a hot corner it will respond in a chosen way. One Hot Corner action is to put display to sleep. To check this go to System Preferences, Desktop & Screen Saver. Click on the Screen Saver tab and at the bottom of that pane is a button for Hot Corners. Click this and see if you hve a hot corner set up.

1
  • Nope, but I changed the one I used to start the screen saver over to instead put the display to sleep. Manual control over display sleep is much more satisfying than having it go black during use! :-) – Greg A. Woods Apr 17 '20 at 2:47
1

So, there is logging, of a sort, and I think I can now confirm the random display sleep I've been observing is indeed due to a software bug.

First off, the logging (and current status) of events and states related to system and display sleep can be found by running:

pmset -g assertionslog

Yesterday my screen stayed on for the rest of the day. However on returning to my computer this morning I found the display off. Pressing a key lit it up and the login window was there, as if I had not told it to keep the display on (but I still allowed it to lock the screen -- seems the screen saver still managed to turn off the display eventually).

About five to ten minutes later the screen went black again while I was scrolling. It continued to go black moments after being turned on again.

After experimenting for a while to see if there was a recognizable pattern in the pmset output, I decided to try killing the processes that seemed to be changing state (i.e. with a plain SIGTERM).

The first one I tried was /usr/libexec/hidd, which was promptly restarted by launchd. This made no difference to the screen going dark every few moments after being re-awoken.

The next one I tried was useractivityd. This had immediate, positive, effect. The screen has not gone black since. Interestingly this process did not die -- it's still running and has been using CPU, but it is no longer being mentioned in any pmset output.

The ongoing saga...

Today after an hour or so of normal use, the screen went black again, and again, and again, often only a second or so after waking it up. Sending SIGTERM to useractivityd again didn't do much so I sent it a SIGKILL. It was immediately restarted by launchd, but the battle to keep the display on continued.

Finally things have settled down again, but I'm not sure what I did to make it so.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .