Jump to content

IOGraphicsAccelerator2 Sierra Lag


radisce
 Share

21 posts in this topic

Recommended Posts

Hi, 

after installing Sierra on my machine a strange behavior has started to happen.
When I leave the Desktop inactive for an amount of time, let's say 10 minutes, and then start to use it again the OS hangs for 30-45 seconds, I can still move the cursor but the interface is freeze, after that period it regain speed and fluidity and everything came back normal. 
I've let the Console open during this freeze in order to better understand what's going wrong in the machine and I've found plenty of this error: 
virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): contexts(0) and queues (747) exceeding limit (512), failing context creation
followed sometimes by this statement: 
kernel: Stalling for detach from nvAccelerator
The error time coincide with the hangs so I suppose the problem is something related to IOGraphicsAccelerator2.
I've the latest nVidia driver installed and the system works like a charm (sleep included) except for this annoying issue, that I've never experienced with the previous OS. 
 
Is anybody able to sort out what the problem is? 
Thanks in advance.

 

 

 

Link to comment
Share on other sites

I too have had the exact same issue for a while now, I haven't been able to track down any particular processes that could be possibly causing virtual IOReturn. Thought maybe it was something to do with my VM, but after shutting that down, I still get the same hesitant panic.

 

 

Gonna keep digging, hopefully I will find right thread to pull to unravel this mystery. Then I will report back here

  • Like 1
Link to comment
Share on other sites

Hi QUEdini, thanks for sharing your experience. 

Which darkwake option are you using? I actually don't inject any darkwake value but since it seems to happen during "approaching to sleep phase" I thought that the issue might be in that boot flag. 

I'll try to play with darkwake value and post my results here. 

Link to comment
Share on other sites

BUM! After about a month searching for a solution to the IOGraphics problem I've found what seems to be the issue. If I set darkwake=3 the problem disappear!!! Sleep and auto sleep work fine and everything is normal so far. 

I've do a little research of what darkwake actually mean for the system and in the OS code I've found: 

// gDarkWakeFlags
enum {
    kDarkWakeFlagHIDTickleEarly      = 0x01, // hid tickle before gfx suppression
    kDarkWakeFlagHIDTickleLate       = 0x02, // hid tickle after gfx suppression
    kDarkWakeFlagHIDTickleNone       = 0x03, // hid tickle is not posted
    kDarkWakeFlagHIDTickleMask       = 0x03,
    kDarkWakeFlagIgnoreDiskIOInDark  = 0x04, // ignore disk idle in DW
    kDarkWakeFlagIgnoreDiskIOAlways  = 0x08, // always ignore disk idle
    kDarkWakeFlagIgnoreDiskIOMask    = 0x0C,
    kDarkWakeFlagAlarmIsDark         = 0x0100
};

Actually it seems that setting darkwake=3 evokes the  kDarkWakeFlagHIDTickleNone Flag, I don't know what that means but reading from the comment line it is something related to gfx and so graphics.

I still have to test my system in deep but as far as I've seen CPU Power Management works as well as the GPU Power Management, so only improvements for now. In addition I don't know if this darkwake setting breaks Power Nap since I don't use it and I'm not really interested in that. 

 

I hope this will be useful to other people that are incurring in this rare but annoying issue. 

  • Like 1
Link to comment
Share on other sites

Did you test long/often enough? Looking at the IOPMrootDomain.cpp from xnu-3789.1.32 (sierra) it seems like kDarkWakeFlagHIDTickleNone is the default value if you don't pass darkwake. And indeed when I do 

sysctl debug.darkwake

 it is set to 3 without setting it.

 

Link to comment
Share on other sites

  • 2 weeks later...

UPDATE

It seems that a definitive solution was found for my machine. 
What didn't worked for me:
- Replace the SSD unit.
- Change darkwake value (I've tried each one).
- Playing with the AGPM kext (Actually it doesn't seem to have any effect on the GTX 970 PM).

What WORKED
I've done a clean install but before doing it I've done the following change to the UEFI setting:
- EHCI Hand Off > Enabled
- XHCI Mode > Auto
- Serial Port > Disabled
- Parallel Port > Disabled
No one single freeze has ever occurred since those changes, I've tested system in deep for 3 days up to now and no problem so far. 
Reading my mobo (H97M-Plus) manual I've found an explanation to this. The PCIe Slots are shared with the EHCI2, Parallels Port and Serial Port Slots, I don't know why but there might be and interference between them, especially when they're working with a not officially supported driver (the Apple one). This is my humble explanation, but what cares the most is that no freezes came up again. 
I know that other times I said that I've found a solution, my mistake since I haven't tested the system properly. This time, instead, after 3 days of tests I can definitely say that this is the most stable configuration I've ever had since El Capitan. 

 

Hope this will work for you all. 

Link to comment
Share on other sites

  • 1 month later...

I seem to have a similar problem:

fault	10:45:11.308695 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (451) created, possibly leaking?
fault	10:45:11.436221 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (452) created, possibly leaking?
fault	10:45:11.487933 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (453) created, possibly leaking?
fault	10:45:11.533609 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (454) created, possibly leaking?
fault	10:45:11.573643 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (455) created, possibly leaking?
fault	10:45:11.599271 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (456) created, possibly leaking?
fault	10:45:11.621694 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (457) created, possibly leaking?
fault	10:45:11.645975 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (458) created, possibly leaking?
fault	10:45:11.697434 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (459) created, possibly leaking?
fault	10:45:11.726176 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (460) created, possibly leaking?
fault	10:45:11.751482 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (461) created, possibly leaking?
fault	10:45:11.790859 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (462) created, possibly leaking?
fault	10:45:11.814450 +0200	kernel	virtual IOReturn IOGraphicsAccelerator2::newUserClient(task_t, void *, UInt32, IOUserClient **): Too many contexts (0) or command queues (463) created, possibly leaking?

This is on an upgraded MacPro with a NVIDIA GeForce GTX970 Card (see my about page for more sys infos).

When just the display goes to sleep and I wake it up again, there's about a 10 Seconds freeze, then sluggishness for about another 5–10 Seconds.

I checked: darkwake=3

Nvidia drivers are the latest.

 

Any ideas?

Link to comment
Share on other sites

  • 2 weeks later...

I was able to find a solution on another forum. The issue appears to be related to iCloud Photos. The fix that has been working for me involved disabling the 'mediaanalysis' daemon. To do so, run the following command:

sudo launchctl unload -w /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist

Simply deleting the 'com.apple.mediaanalysisd.plist' will also do the trick. Hope this helps.

  • Like 1
Link to comment
Share on other sites

I was able to find a solution on another forum. The issue appears to be related to iCloud Photos. The fix that has been working for me involved disabling the 'mediaanalysis' daemon. To do so, run the following command:

sudo launchctl unload -w /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist

Simply deleting the 'com.apple.mediaanalysisd.plist' will also do the trick. Hope this helps.

 

Interesting, I don't seem to have that deamon in my launchagents folder. I do use iCloud Photos :/ Would you have any clue as to why?

Link to comment
Share on other sites

Interesting, I don't seem to have that deamon in my launchagents folder. I do use iCloud Photos :/ Would you have any clue as to why?

 

 

Hmm, that is strange. I just checked on several other Macs that I have access to, and "com.apple.mediaanalysisd.plist" exists in "/System/Library/LaunchAgents/" on each one. Did the launchctl command fail, or is the plist file actually missing?

Link to comment
Share on other sites

Hmm, that is strange. I just checked on several other Macs that I have access to, and "com.apple.mediaanalysisd.plist" exists in "/System/Library/LaunchAgents/" on each one. Did the launchctl command fail, or is the plist file actually missing?

 

Yeah the command fails too, returns with the following: /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist: Could not find specified service .

 

I just have a nvidia.nvagent and two teamviewer deamons in the LaunchAgents folder. Yeah definitely no mediaanalysis deamon. Checked my macbook too, which is obviously no hack :P, and also doesn't have that deamon. Where did you find out about this fix?

 

Cheers for helping out though.

Link to comment
Share on other sites

Yeah the command fails too, returns with the following: /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist: Could not find specified service .

 

I just have a nvidia.nvagent and two teamviewer deamons in the LaunchAgents folder. Yeah definitely no mediaanalysis deamon. Checked my macbook too, which is obviously no hack :P, and also doesn't have that deamon. Where did you find out about this fix?

 

Cheers for helping out though.

 

The fact that you are only seeing a couple of plist files leads me to think you may be looking in wrong location (possibly in your User's "LaunchAgents" folder,  and not the System location). There should be several hundred files in /System/Library/LaunchAgents. Also, be sure that you have SIP disabled, otherwise you won't be able to modify anything in /System/Library/LaunchAgents. 

Link to comment
Share on other sites

The fact that you are only seeing a couple of plist files leads me to think you may be looking in wrong location (possibly in your User's "LaunchAgents" folder,  and not the System location). There should be several hundred files in /System/Library/LaunchAgents. Also, be sure that you have SIP disabled, otherwise you won't be able to modify anything in /System/Library/LaunchAgents. 

 

You're totally right. Still learning here :P So the command you gave me didn't work, but I found the System Library folder and located the correct daemon and deleted it. To my surprise the lag at idle issue totally resolved itself. I've tested it now a few times, and its smooth as smooth can be. Thank you so much, Dan!

  • Like 1
Link to comment
Share on other sites

You're totally right. Still learning here :P So the command you gave me didn't work, but I found the System Library folder and located the correct daemon and deleted it. To my surprise the lag at idle issue totally resolved itself. I've tested it now a few times, and its smooth as smooth can be. Thank you so much, Dan!

 

Glad you got it sorted! Happy to help.

Link to comment
Share on other sites

  • 1 month later...

I'm having the same issue as above on a 2012 Mac Pro 5,1 running 10.12.5 with a Macvidcards GTX980 and the latest Nvidia web driver.

 

When waking from sleep it's a slow system hang for about 30-45 secs and I'm getting the same errors in the console. Trying out DanMcQ's post to delete the com.apple.mediaanalysisd.plist file after disabling SIP.

 

Thanks again DanMcQ for posting...

Link to comment
Share on other sites

I was able to find a solution on another forum. The issue appears to be related to iCloud Photos. The fix that has been working for me involved disabling the 'mediaanalysis' daemon. To do so, run the following command:

sudo launchctl unload -w /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist

Simply deleting the 'com.apple.mediaanalysisd.plist' will also do the trick. Hope this helps.

 

This doesn't work for me:

bash-3.2# launchctl unload -w /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist 
/System/Library/LaunchAgents/com.apple.mediaanalysisd.plist: Could not find specified service

I checked, the com.apple.mediaanalysisd.plist is present.

I cannot delete it, nor move it, even as root:

bash-3.2# rm -f /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist 
rm: /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist: Operation not permitted
Link to comment
Share on other sites

You cannot modify the file in question, since it is being protected by Apple's System Integrity Protection.

 

Reboot with apple-R

Open terminal

Type: 

csrutil disable

reboot

 

After that, you can remove the file (/System/Library/LaunchAgents/com.apple.mediaanalysisd.plist)

 

Maybe it would be a good idea to enable SIP again after this.

  • Like 1
Link to comment
Share on other sites

You cannot modify the file in question, since it is being protected by Apple's System Integrity Protection.

 

Reboot with apple-R

Open terminal

Type: 

csrutil disable

reboot

 

After that, you can remove the file (/System/Library/LaunchAgents/com.apple.mediaanalysisd.plist)

 

Maybe it would be a good idea to enable SIP again after this.

For the moment it worked for me, thnx  :thumbsup_anim:

Link to comment
Share on other sites

 Share

×
×
  • Create New...