If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Preventing server sleep during streaming?

bg3bg3 Posts: 28Members, Plex Pass Plex Pass

Is there a setting somewhere to tell the Plex server to send a “do not sleep” message to the Energy Saver process on the Mac? My Mac server is set to sleep on idle, but it’s sleeping during streaming to a client. Not fun when you’re in the middle of watching something and it disconnects.

Thanks in advance.

Answers

  • bg3bg3 Posts: 28Members, Plex Pass Plex Pass

    Unless this documentation is outdated, this is what Plex server should probably be doing to prevent sleep while streaming.

    https://developer.apple.com/library/content/qa/qa1340/_index.html

    "Applications have a chance to prevent sleep by calling IOCancelPowerChange”

    Can one of the devs check for this and then file a bug with Apple if it’s not working?

  • SE56SE56 Posts: 2,171Members, Plex Pass Plex Pass
    edited January 13

    This apple support page may assist. Some earlier model Macs have this issue, I have a more recent model now and have no issues running High Sierra. Then again others have had issues with remote access but that's another story.

    https://support.apple.com/en-au/HT202824

    If this does not help you can try the following suggestions.

    https://support.apple.com/en-au/HT201295.

    http://www.zhornsoftware.co.uk/caffeine/

    TV:(1). LG 65UB950T UHD Smart TV WebOS 1.4, (2). Hisense 50K3300UW.Receiver Onkyo TX-NR646 Network Receiver, ARC configured. Server: iMac Late 2015, 32Gb Ram, 3.2GHz Intel i5 Skylake processors.Storage: 3 WD External USB3 HDD. Devices: 2 iPad Air 2 connected with AC Wifi Dual Band. Network: Gigabite Ethernet hardwired , 5 outlets with Cat 6 and 2 Ethernet switches, Full Duplex, AVB mode enabled Remotes: Onkyo ios app, Plex ios, LG Magic remote.Speakers: Bowers and Wilkins Floor Standing Fronts and Mordaunt-Short Genie, Centre, 200W Powered Sub & 4 Satellite Surrounds. Configured for 7.1 Channels.

  • bg3bg3 Posts: 28Members, Plex Pass Plex Pass

    This isn’t a problem with the Mac — it’s a problem with Plex server. Other services keep the Mac awake while they are active. I’m not setting the server to “never sleep” — this is 2017. That’s the point of the “Wake for network access” setting in your screenshot.

  • SE56SE56 Posts: 2,171Members, Plex Pass Plex Pass
    edited January 14

    Well to answer you I'm using the public release not the "pass" release and have no issue. So if you feel so strongly it's not a Apple issue roll back. You will need to change your PMS settings to "Public" and manually install the public release. When it's fixed you can update again. As for 2017 that finished a fortnight ago and I do not understand your reference to the issue in that vain.

    If you would like to elaborate on error messages or behavior during your issue it may relate to other known problems. What happens with your stated disconnect. It is strange no one else has chimed in with similar issues in the discussion.

    https://plex.tv/downloads

    TV:(1). LG 65UB950T UHD Smart TV WebOS 1.4, (2). Hisense 50K3300UW.Receiver Onkyo TX-NR646 Network Receiver, ARC configured. Server: iMac Late 2015, 32Gb Ram, 3.2GHz Intel i5 Skylake processors.Storage: 3 WD External USB3 HDD. Devices: 2 iPad Air 2 connected with AC Wifi Dual Band. Network: Gigabite Ethernet hardwired , 5 outlets with Cat 6 and 2 Ethernet switches, Full Duplex, AVB mode enabled Remotes: Onkyo ios app, Plex ios, LG Magic remote.Speakers: Bowers and Wilkins Floor Standing Fronts and Mordaunt-Short Genie, Centre, 200W Powered Sub & 4 Satellite Surrounds. Configured for 7.1 Channels.

  • bg3bg3 Posts: 28Members, Plex Pass Plex Pass

    Thanks. I’ll give that a try. And yep, 2017 is over. Time flies!

  • bg3bg3 Posts: 28Members, Plex Pass Plex Pass

    So I used the pmset terminal command to check, and Plex is registering as “ PreventUserIdleSystemSleep” while streaming. I’ll do some more digging.

    pid 1407(Plex Media Server): 00:00:08 PreventUserIdleSystemSleep named: "PreventUserIdleDisplaySleep"

    http://hints.macworld.com/article.php?story=20120701234338952

  • SE56SE56 Posts: 2,171Members, Plex Pass Plex Pass

    This maybe the problem. recently i was having issues during streaming and put it down to other processes. Removed Spotlight indexing from PLEX storage drives and stopped Automatic backup with time machine.

    TV:(1). LG 65UB950T UHD Smart TV WebOS 1.4, (2). Hisense 50K3300UW.Receiver Onkyo TX-NR646 Network Receiver, ARC configured. Server: iMac Late 2015, 32Gb Ram, 3.2GHz Intel i5 Skylake processors.Storage: 3 WD External USB3 HDD. Devices: 2 iPad Air 2 connected with AC Wifi Dual Band. Network: Gigabite Ethernet hardwired , 5 outlets with Cat 6 and 2 Ethernet switches, Full Duplex, AVB mode enabled Remotes: Onkyo ios app, Plex ios, LG Magic remote.Speakers: Bowers and Wilkins Floor Standing Fronts and Mordaunt-Short Genie, Centre, 200W Powered Sub & 4 Satellite Surrounds. Configured for 7.1 Channels.

  • bg3bg3 Posts: 28Members, Plex Pass Plex Pass

    So I did some more digging, and I found that streaming from iTunes to an Apple TV or another iTunes client sets "NetworkClientActive” mode on the server and the Mac does not go to sleep during the stream. Plex streaming uses “PreventUserIdleSystemSleep". iTunes keeps the Mac awake during stream, Plex server does not. Mounting a file server from the same mac also uses “NetworkClientActive” and also keeps the mac from sleeping.

    It could be a bug with macOS 10.13.2 and PreventUserIdleSystemSleep. We’ll see what 10.13.3 does (should be out soon) and I will follow up again.

    I’m surprised no other Mac users have reported this. I guess most people aren’t using a mac as a server, or are keeping their server from sleeping, or it has something to do with using older mac hardware as the server.

  • bg3bg3 Posts: 28Members, Plex Pass Plex Pass

    Oh look…

    https://forums.plex.tv/discussion/204914/plex-server-seems-to-use-deprecated-sleep-assertion/p2

    So it’s not just me. These users gave up and rolled their own solution through a background script. I’m still having the same issue under 10.13.2. The issue is definitely related to “Wake On Lan” — the Mac wakes up when a Plex client makes a request, then the server starts to stream, the server makes the PreventUserIdleSystemSleep assertion, then the Mac still goes to sleep when it hits the sleep on idle timer (in spite of the assertion and the open network connection).

    Might be worth switching Plex to the “NetworkClientActive” assertion since this is what iTunes uses during streaming.

  • bg3bg3 Posts: 28Members, Plex Pass Plex Pass

    Also possibly related:

    https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventuseridlesystemsleep

    "This assertion does not put the system into Dark Wake.”

    So it sounds to me that would mean it wakes, but this assertion won’t keep it awake. Which would mean the Plex server is using the wrong call here. It should likely use “NetworkClientActive” like iTunes, SMB, and other network-based services or “PreventSystemSleep”” while streaming. It should of course release the assertion when clients are no longer streaming. This would allow the server to go back to sleep on idle, and in turn the server can be re-awakened by a streaming client through Bonjour sleep proxy and Wake On Lan.

    https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventsystemsleep?language=objc

    "When asserted and set to level kIOPMAssertionLevelOn, the system will prefer to enter the Dark Wake state, or remain in Dark Wake if already there, rather than go to sleep."

Sign In or Register to comment.