Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Stephen.R

Suspended
Original poster
Nov 2, 2018
4,356
4,747
Thailand
Hey all,

I've re-purposed my 2011 MBP17 to run iTunes, amongst other things, for our AppleTVs in the house. Every so often videos won't load, or the iTunes library just disappears completely on the AppleTV, and the "solution" is to hit a key on the keyboard to wake it up, which solves the problem almost instantly.

The machine is set to never sleep - either on power or battery, and yet it still does apparently.


Any ideas about what may be causing this?

It's running the latest release of High Sierra.
 

Brian33

macrumors 65816
Apr 30, 2008
1,472
372
USA (Virginia)
I have similar problems trying to use my Mac Mini as my iTunes "server", and I suspect it's a bug of some sort in iTunes.

I (used to) use the (iTunes) Remote app on my phone to switch the Airplay destination to one of several devices (two Apple TV boxes, an Airport Express, my Denon AVR, or my iMac running Airserver. It all used to work wonderfully, but a year or so ago it became flaky. A few hours after I'd last played audio, I'd try again and it wouldn't play, or I'd be unable to get the Remote app to make iTunes switch to a different destination, or the iTunes library just wouldn't show up.

My iTunes "server" is running on my Mac Mini (running High Sierra) which is set to not sleep, and I'm quite sure it does not. It's a little hard to know, as it runs "headless" without a monitor or keyboard, but it is a syslog destination for my router/access points and it never misses a log message from them. So in my case I don't think going to sleep mode is the problem -- I think some update of iTunes introduced some bugs.

I'm unsure if a single keypress would "unstick" iTunes for me. I've usually restarted it, but just now I noticed that if I remote log into the Mini and change the Airplay destination in iTunes it does temporarily fix the problem...

I really wish I could get this working reliably again!

You should be able to determine if your MBP is going to sleep by examining the system log (/var/log/system.log). I believe messages are logged there when entering sleep and waking up. First set the MBP to sleep, wait, look and find what the message text is, then turn off sleep and see if system sleep messages still show up. Inconvenient, but it could prove/disprove your hypothesis.
 

Stephen.R

Suspended
Original poster
Nov 2, 2018
4,356
4,747
Thailand
Hey Brian,

Thanks for the info. I intended to reply back but I’ve been sick as a dog all weekend and it slipped my mind after I discovered essentially the same thing:

I have a http service running on it, and last night while upstairs it stopped working. I opened up the address for the http service and it loaded fine, so it’s not actually going to sleep, and it’s not “just” dropping wifi (my next, original guess).

I restarted the machine in the morning and it’s been fine since then.

I may just setup auto login and then have a restart scheduled for every day at 5am or something. Or maybe it’s enough to just restart iTunes on a schedule?

I’ll post back with results if/when I see any changes in behaviour.
 

Brian33

macrumors 65816
Apr 30, 2008
1,472
372
USA (Virginia)
Stephen,
I have to thank you for your post, because it prompted me to try harder to track down my own iTunes problem, where iTunes would seem to hang, or stop responding to the iOS Remote app. After a lot of effort, I have found a system settings change which seems to resolve my problems. For the past few days my iTunes server has been reliably sending music throughout my house.

The two changes that fixed my problem are
System Preferences-->Desktop & Screen Saver-->Start after: changed from 10 min.s to "NEVER"
System Preferences-->Security & Privacy--> changed from "Require password 5 mins after sleep or screen saver begins" to now be UN-CHECKED.

(I had already set the computer to never sleep. I haven't tried those changes one at a time yet, but I suspect I could turn the screen saver back on.)

So my problem had something to do with the interaction between iTunes and the screen saver and/or the password prompt screen. Weird.

Changing those settings is OK for me because I normally have no monitor or keyboard attached to my Mac Mini --- when I need to work with it I just use screen sharing. And even with "require password" setting off, it's still (somewhat) secure because screen sharing itself requires the account password before connecting. So my family or friends can't easily access that account. (Someone in my household could physically attach a monitor & keyboard and gain access to that account, but I'm willing to accept that.)

I spent a lot of time looking through log files, but what tipped me off was that often (always?) just connecting via screen sharing would un-freeze iTunes. I.e., after typing my password on my local machine for the Screen Sharing feature, it would connect to the Mac Mini and show its password prompt and simultaneously make iTunes responsive to the Remote app again.

If you are interested, I learned how to get a lot of information about iTunes processing. If you enter the following 'log' command in Terminal, you'll see all sorts of interesting debug type messages as iTunes is running. Turns out I didn't solve my mystery that way, but perhaps it will be useful to you or someone else:

log stream --style syslog --predicate 'senderImagePath contains[cd] "iTunes"' --info

(This command is for Sierra [I think] or later. Hit Ctrl-C to terminate it.)
 
  • Like
Reactions: Stephen.R

Brian33

macrumors 65816
Apr 30, 2008
1,472
372
USA (Virginia)
My iTunes getting stuck problem is back, so those Preferences changes did not solve it after all. iTunes "wakes up" when I initiate screen sharing to the Mac Mini, but not when I connect via SSH. Back to the drawing board...
 

Stephen.R

Suspended
Original poster
Nov 2, 2018
4,356
4,747
Thailand
I tried disabling screensaver (but not lock screen - a 2 1/2 year old, and the machine is right there, screen propped open slightly, just waiting for him to touch something) and it maybe improved somewhat - but it does still happen.

This weekend is dedicated to installing a 16M (52' for those who don't use metric) buried stormwater drain, but I'm going to put wired ethernet from the router to the desk... next weekend (he says optimistically) and will see if that improves anything.
 

MacInTO

macrumors 65816
Apr 25, 2005
1,212
229
Canada, eh!
If you haven't figured this out, it is likely your hibernate timer.

If you open a Terminal window and run the command, pmset -g

You will see the two parameters among many others,

standbydelay
autopoweroffdelay

If you change autopoweroff delay to a longer value (in seconds) it won't hibernate in the given timeframe.

The command to change it is, sudo pmset -a autopoweroffdelay #

- where # is the number of seconds.

If iTunes or other media is playing, the machine won't go to sleep. But if it is in sleep mode it could hibernate.

I run iTunes on my MacBook and it would not wake from a button press on the remote. I would have to press the spacebar on the machine to wake it. If it's in sleep mode, I can wake it from a button press on the remote.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.