Page MenuHome

Blender Prevents OSX Mavericks From Sleeping
Closed, ArchivedPublic

Description

System Information
OSX 10.9
Intel HD4000

Blender Version
Broken: (example: 2.69.10 who can remember a hash, revision numbers were more human friendly)
Worked: (optional)

Short description of error
I am new to OSX but when I have Blender open OSX can never go to sleep or enter power management mode.

Exact steps for others to reproduce the error
Open Blender on OSX 10.9 or better.
Hide Blender so it is no longer visible on the screen.
Walk away and get coffee and talk to people at the water cooler.
Go to sleep or wait and come back to the computer and you will find that the OSX machine has never entered sleep or screen saver mode. NOTE: Blender is not rendering, it is just sitting there idle.

I notice Adobe products do not have this problem and the system works fine with them.

Event Timeline

Atomic (atomic) raised the priority of this task from to 90.
Atomic (atomic) updated the task description. (Show Details)
Atomic (atomic) added a project: BF Blender.
Atomic (atomic) edited a custom field.
Atomic (atomic) added a subscriber: Atomic (atomic).

I can't redo the problem here on a MacBook Pro with NVidia 650M GT and OS X 10.9.1. I tried the Blender 2.69 release and the latest development version.

Does this happen with the default cube, just start Blender and it doesn't go to sleep, or only particular .blend files? Do you have any addons enabled that are causing this?

I tried with Blender open, minimized and hidden, but the machine always goes to sleep here.

Brecht Van Lommel (brecht) lowered the priority of this task from 90 to 30.Feb 18 2014, 5:53 PM

Use the following command to see which processes are keeping OS X going to sleep:

pmset -g assertions

I can actually confirm that after Blender fires up, the coreaudiod process becomes active and prevents entering sleep.

Here's the output without Blender running:

maczilla:~ bart$ pmset -g assertions
20-02-14 11:53:09 CET    
Assertion status system-wide:
BackgroundTask                 0
PreventDiskIdle                0
ApplePushServiceTask           0
UserIsActive                   0
PreventUserIdleDisplaySleep    0
InteractivePushServiceTask     0
PreventSystemSleep             0
ExternalMedia                  0
PreventUserIdleSystemSleep     0
NetworkClientActive            0
Kernel Assertions: 0x104=USB,MAGICWAKE
id=500  level=255 0x4=USB mod=29-01-14 17:39 description=EHC1 owner=AppleUSBEHCI
id=501  level=255 0x4=USB mod=20-02-14 10:58 description=EHC2 owner=AppleUSBEHCI
id=502  level=255 0x100=MAGICWAKE mod=14-02-14 07:56 description=en0 owner=en0

After starting Blender, I see:

maczilla:~ bart$ pmset -g assertions
20-02-14 11:54:15 CET    
Assertion status system-wide:
BackgroundTask                 0
PreventDiskIdle                0
ApplePushServiceTask           0
UserIsActive                   0
PreventUserIdleDisplaySleep    0
InteractivePushServiceTask     0
PreventSystemSleep             0
ExternalMedia                  0
PreventUserIdleSystemSleep     1
NetworkClientActive            0
Listed by owning process:
pid 148(coreaudiod): [0x0000000100001e8b] 00:00:04 NoIdleSleepAssertion named: "com.apple.audio.'AppleHDAEngineOutput:1B,0,1,2:0'.noidlesleep"
Kernel Assertions: 0x104=USB,MAGICWAKE
id=500  level=255 0x4=USB mod=29-01-14 17:39 description=EHC1 owner=AppleUSBEHCI
id=501  level=255 0x4=USB mod=20-02-14 10:58 description=EHC2 owner=AppleUSBEHCI
id=502  level=255 0x100=MAGICWAKE mod=14-02-14 07:56 description=en0 owner=en0

Some system info: OS X 10.9.1, ATI Radeon HD 5750 1024 MB video card. Tested using 2.69 Release version with the default cube scene.

Mine sleeps with blender open, minimized, etc OS X 10.9.1, AMD Radeon HD 6770M 1024 MB. Tested with release and master trunk. Can't make it not sleep as a matter of fact.

Hi
It is pretty clear that coreaudio prevents sleep here:

PreventUserIdleSystemSleep     1
NetworkClientActive            0
Listed by owning process:
pid 195(coreaudiod): [0x0000000100001e8b] 00:00:04 NoIdleSleepAssertion named: "com.apple.audio.'AppleHDAEngineOutput:1B,0,1,2:0'.noidlesleep"



jens-macpro:~ jensverwiebe$ ps u -p 195
USER          PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
_coreaudiod   195   1,2  0,1  2566812   9528   ??  Ss   11:24am   0:29.80 /usr/sbin/coreaudiod

So i tested preferences audio and found openAL and SDL cause this, but not Jack ( and "drumroll": None )

So a workaround is to set audio to None or Jack atm. .

I will try to find out whats the background of this.

Jens

K, found this from stackoverflow, should be implemented in audaspace i guess:

To participate in power management decisions, you'll need to add your device driver to the power management plane, typically in your overridden IOService::start(provider) method:

PMinit();
provider->joinPMtree(this);
registerPowerDriver(this, powerStates, numPowerStates);
where powerStates and numPowerStates specifies an array of power states you want your device to be able to be in. You'll probably not want more than 2 for a virtual device, and maybe you even only need one. I suspect a superclass of your class is setting states that are inhibiting sleep. Once you've registered for power management, your driver will be expected to handle the power management methods such as IOService::setPowerState().

Wiil take a deeper look hopefully before 2.7 release.

Will add Nexyon as he's the module owner.

Jens

Added Jörg ( not Peter, sorry ) as he needs to attend this for his audaspace library too.

Jens

Here's a suggestion:

#import <IOKit/pwr_mgt/IOPMLib.h>

// kIOPMAssertionTypeNoDisplaySleep prevents display sleep,
// kIOPMAssertionTypeNoIdleSleep prevents idle sleep

//reasonForActivity is a descriptive string used by the system whenever it needs 
//  to tell the user why the system is not sleeping. For example, 
//  "Mail Compacting Mailboxes" would be a useful string.

//  NOTE: IOPMAssertionCreateWithName limits the string to 128 characters. 
CFStringRef* reasonForActivity= CFSTR("Describe Activity Type");

IOPMAssertionID assertionID;
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, 
                                    kIOPMAssertionLevelOn, reasonForActivity, &assertionID); 
if (success == kIOReturnSuccess)
{

    //Add the work you need to do without 
    //  the system sleeping here.

    success = IOPMAssertionRelease(assertionID);
    //The system will be able to sleep again. 
}

Sources:

I'm not sure if adding such calls would solve the problem, it seems to be for preventing the OS from sleeping but we need to do the opposite. I think that it is the OpenAL or SDL libraries holding things up and that a fix can only be done there. But these are libraries typically used for games which will keep the OS awake anyway.

Maybe the solution is to lazily initialize the audio system and shut it down after it is not used for some time? Maybe that's too slow for starting playback, I don't know.

Bastien Montagne (mont29) raised the priority of this task from 30 to Normal.Mar 28 2014, 6:49 PM
Sergey Sharybin (sergey) changed the task status from Unknown Status to Unknown Status.Sep 17 2014, 2:13 PM

For sure we can try working this around, but i'm not sure why those libraries will ever affect on sleep on OSX, it doesn't happen on other systems..

Workaround would be to use None system backend as well.

Thanks for the report, but since the issue is actually in a library we don't maintain moving to a TODO http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/Install-OS#Mac_OS_X