Fix random few-second freezes in Mountain Lion
princeton.edu
princeton.edu
Various approaches have been suggested on the online forums, including editing the config files to be more lenient about these protections (the so called "alternative approach" proposed by the poster)
I tried them all, never had any result. I almost gave up, then read about that safe mode reboot suggestion. I have long uptimes and I don't want to bother reopening stuff, so I didn't do it immediately.
But finally I did, and it worked. Based on the timestamp of my blog (http://en.blog.guylhem.net/) I tried that on mar 31, about 1 month ago, and here are the results from the syslog so far (1 month of data after the fix):
# bzgrep sandboxd /var/log/system.log*|grep deny|sed -e 's/.*bz2://g'|sort|wc
97 1441 18032
About 97 issues of sandboxing zealousness remain, if we distinct them by removing the PIDs with : # bzgrep sandboxd /var/log/system.log*|grep deny|sed -e 's/.*macbookair//g' -e 's/[0-9]*//g' |sort|uniq
kernel[]: Sandbox: sandboxd() deny mach-lookup com.apple.coresymbolicationd
.guylhem.org sandboxd[] ([]): Preview() deny file-read-data /Users/guylhem/C/abcdef.jpeg
.guylhem.org sandboxd[] ([]): Preview() deny file-write-data /Users/guylhem/C/abcdef.jpeg
.guylhem.org sandboxd[] ([]): QuickLookSatelli() deny file-read-data /Users/guylhem/Desktop/Wolfram Science Summer School Application_files/.css
.guylhem.org sandboxd[] ([]): QuickLookSatelli() deny mach-lookup com.apple.PowerManagement.control
.guylhem.org sandboxd[] ([]): TextEdit() deny mach-lookup com.apple.SystemConfiguration.SCNetworkReachability
.guylhem.org sandboxd[] ([]): TextEdit() deny mach-lookup com.apple.tsm.portname
.guylhem.org sandboxd[] ([]): TextEdit() deny system-socket
.guylhem.org sandboxd[] ([]): VTDecoderXPCServ() deny file-read-data /Users/guylhem/Library/Preferences/.GlobalPreferences.plist
.guylhem.org sandboxd[] ([]): mdworker() deny file-read-data /Library/Filesystems/NetFSPlugins ()
.guylhem.org sandboxd[] ([]): mdworker() deny file-read-data /Library/Filesystems/NetFSPlugins (pre-ls-info fstype:mtmfs fsflag: flags: diag: uti:com.apple.application-bundle plugin:/Library/Spotlight/Application.mdimporter - find suspect file using: sudo mdutil -t )
.guylhem.org sandboxd[] ([]): mdworker() deny file-read-xattr /Users/guylhem/Library/Application Support/Google/Chrome/Safe Browsing Bloom (pre-plugin fstype:hfs fsflag:D flags:E diag: uti:public.data plugin:internalPlainTextImporter - find suspect file using: sudo mdutil -t )
.guylhem.org sandboxd[] ([]): mdworker() deny mach-lookup com.apple.PowerManagement.control (import fstype:hfs fsflag:D flags: diag: uti:com.microsoft.excel.xls plugin:/Library/Spotlight/Microsoft Office.mdimporter - find suspect file using: sudo mdutil -t )
.guylhem.org sandboxd[] ([]): mdworker() deny mach-lookup com.apple.PowerManagement.control (import fstype:hfs fsflag:D flags: diag: uti:org.openxmlformats.presentationml.presentation plugin:/Library/Spotlight/Microsoft Office.mdimporter - find suspect file using: sudo mdutil -t )
.guylhem.org sandboxd[] ([]): mdworker() deny mach-lookup com.apple.PowerManagement.control (import fstype:hfs fsflag:D flags:E diag: uti:com.microsoft.excel.xls plugin:/Library/Spotlight/Microsoft Office.mdimporter - find suspect file using: sudo mdutil -t )
.guylhem.org.home sandboxd[] ([]): Preview() deny mach-lookup com.apple.SystemConfiguration.SCNetworkReachability
.guylhem.org.home sandboxd[] ([]): Preview() deny system-socket
.local sandboxd[] ([]): QuickLookSatelli() deny mach-lookup com.apple.PowerManagement.control
.local sandboxd[] ([]): VTDecoderXPCServ() deny file-read-data /Library/Preferences/.GlobalPreferences.plist
.local sandboxd[] ([]): fontworker() deny mach-lookup com.apple.ls.boxd
This last one is interesting : # bzgrep com.apple.ls.boxd /var/log/system.log*
/var/log/system.log.2.bz2:Apr 26 18:23:37 macbookair.local sandboxd[64] ([62]): fontworker(62) deny mach-lookup com.apple.ls.boxd
lsboxd sqweaked only once in a month - and for something different.I'd call this "problem solved", which is supported by my personal observation over this last month : I haven't experienced the problem again yet, while previously it was at least every 2 days (along with the TimeMachine always reindexing)
My suggestion: check your logs with the greps, try this simple fix and report your results in a month.
EDIT: This in on my macbookair with a 480GB OWC SSD (but apparently it also occurs on macbookair with vanilla apple ssds). I used istat menus, and still do. I didn't disable the dynamic pager, spotlight or anything else.
(EDIT2: removed) - thanks for the 4 spaces suggestion! as explained, the simple safe reboot solution made the problem go away, while other approaches didn't. It works for me, and I have 1 month of data supporting that.
The problem of sandbox violation lines appearing in your Console is caused by sandboxing. It's unlikely that it goes any further than that.
The author has associated some other silent issue with his system to this one sandbox violation just because it happens to be printed all the time.
If you're experiencing some performance problem, run sysdiagnose(1) (or hit the key combo in its man page) and throw it into Apple's bug reporter. Or, if you stare at the output for a very long time, you might even figure out how to read it.
Lines prefixed with four spaces go into <code> tags.
But my new MBP has been sluggish from day one. That is, from the moment I migrated my user files from my old box. It's possible that I got some stuff that affects performance. Three things helped:
* First, disabling the dynamic pager [1]. This one has a dramatic effect on performance. In theory, it will prevent OS X from swapping out apps unnecessarily (which it will do even when the apps are active and there is plenty of RAM). I did have some, but not much, swapping going on, but it still improved performance.
* Secondly, I uninstalled iStat Menus. I can't be sure that this contributed to the performance problems, but I won't risk reinstalling to find out. It seems to have helped a bit.
* Thirdly, I disabled Spotlight indexing of my home directory. This way Alfred will still autocomplete apps. Some apps lose their search functionality, but I never use Spotlight, and I find that I can live without it.
I tried the sandbox config fix, but it made no difference to me.
The remaining sluggishness seems to come from the graphics layer. For example, doing the Exposé "reveal all windows" command takes 3-4 seconds on my box and has a frame rate of approximately 1 fps. It's not great. I notice the reduced graphics performance when scrolling pages in Chrome, whereas Safari is smoother. I suspect this is Retina being a bit too ambitious compared to actual current graphics card performance.
As an aside, I believe OS X's I/O system has traditionally been its weak point, being a Mach-based hybrid-microkernel architecture. You can cause GUI scheduling problems by overloading the I/O system, and it's possible that this is exacerbated by having a SSD.
It's almost certain that migrating something from your old mac caused this. Clean installs of OS X do not have the problems you describe, even on the 13" rMBP's weak GPU.
First, disabling the dynamic pager [1].
I don't know what you tried to link to, but I'm guessing it's similar to this blog post from a while back: http://workstuff.tumblr.com/post/20464780085/something-is-de... . The author changed his mind after 10.8 came out: http://workstuff.tumblr.com/post/28556080639/mountain-lion-s...
Disabling dynamic_pager disables swap, and that's not a good idea on OS X. Any perceived difference in performance is likely placebo. Have you tried a blind test? Have a friend disable/enable swap and see if you can guess correctly. You might be surprised at the results.
Instead of risking the instability and performance degradation that is likely to occur when changing low-level OS settings, you should figure out what you migrated that's causing the issue. Do some science. If you create another account and log in, do the issues persist? What if you boot off the restore partition? Are there any specific errors in the system console? If you backup, erase, and install a clean OS X, do the issues persist? What if you copy your dotfiles over to this clean install? What if you copy your old ~/Library to it? Etcetera. Once you reproduce the problem, you can use time machine to restore to an unaffected version.
You might as well upgrade from Windows XP to Windows 7, hack a bunch of registry entries to change kernel behavior, and then complain that Windows is buggy and slow. Blaming the operating system is easy, but it won't fix your problem. The cause is something you copied from your previous set-up. Find it and you'll be a much happier camper.
That's the link. He didn't change his mind, he merely upgraded and got better performance. That did not happen in my case.
> Have you tried a blind test?
No need. Before the change, my mouse pointer was freezing up every few seconds, and I got "IOHIDSystem cursor update overdue. Resending." in the system log very frequently. This disappeared completely after disabling the pager.
The difference in performance is stunning. For example, previously, opening a new tab in Chrome would not animate the tab line correctly, resulting in a weird "jolt" as the tab came into place. Now it's smooth.
> Do some science.
The problem is that these things take a lot of time. Time that I don't have. At some point I might create a new user and see if that helps.
Both sound like problems TOTALLY unrelated to the dynamic paging, that accidentally were solved by disabling it. Especially seeing that people with the paging enabled don't see any slowdowns such as these AT ALL.
My guess is some BS software left over from the previous installation, a SIBML plugin, a haxie, or something else faulty, that caused the unnecessary paging. If you have found and removed that, then you wouldn't have had other issues with the paging functionality.
The IOHIDSystem problem is claimed to disappear if you do the sandbox fix, but it did not help in my case.
I don't have SIMBL plugins, I don't have extensions such as FUSE, or otherwise any weird software that could be the culprit.
I don't deny that it's possible that there is something else. But I have spent a lot of time on this already, and not found anything.
[1] http://workstuff.tumblr.com/post/20464780085/something-is-de...
I.e that if someone doesn't disable paging, he will have the effects you describe.
Even if it's paging related it's probably something that effect specific users, not some overall fault in the implementation of paging.
Yes, I know how swap works - I'm a kernel developer (mainly FreeBSD, but I have experience with most mainstream desktop kernels, including Windows). No, it's not dangerous to run without it in 2013 if you have enough memory.
I have a feeling that the animations would be a lot smoother (and battery life a lot shorter) if the GP forced their laptop to use the dedicated graphics card.
[1] GT330M benchmark (2010 Macbooks) http://www.videocardbenchmark.net/gpu.php?gpu=GeForce+GT+330...
[2] Intel HD4000 benchmarks (2012~ Macbooks) http://www.videocardbenchmark.net/gpu.php?gpu=Intel+HD+4000
Anyway. Mine is slow too. With the nvidia card everything is mostly fine, with the integrated intel card everything is mostly sluggish.
There was a review of the 13" retina when it came out saying that the intel gpu was terrible and that he sent the laptop back and was going to wait for the next generation.
It will also let you choose which GPU to use which is useful for testing.
[1]: http://gfx.io/
It's particularly bad when in clamshell mode, plugged into the Thunderbolt display.
kernel_task CPU usage shoots up when CPU throttling kicks in. I suspect however GPU throttling also is affecting performance.
At times the GUI just feels really slow and laggy. Seriously considering ditching OS X altogether.
It isn't the fact that stuff goes wrong that bugs me, it is the fact that seemingly both the problems and solutions are via "magic." Even people who claim to be very UNIX knowledgable have no idea what is going wrong...
When Apple's stuff works it "just works." When Apple's stuff stops working then you're SOL.
Sounds like rationalizing the non-purchase to me.
Nothing voodoo about how OS X works. Just that nobody bothered to investigate this problem further (and that OS X sandboxing a custom component, and a recent one at that, not some standard UNIX/POSIX functionality, so not everybody is familiar with it). My guess is that the safe-boot thing lets some maintenance scripts run uninhibited by restrictions set in other run levels, which fixes the md issue.
That said, md is just a normal unix process. If you cared enough to find this out, you can see what's going one with fs_usage, you have Dtrace available and other niceties etc.
In any case, nothing unlike the numerous problems people have with the intricacies of selinux.
As for Windows... just restart it, you'll be fine. ;)
I don't find this latest OS X buglet to be difficult to understand, but then, I've been using OS X for ages.
#edit: also, how exactly does one get as familiar with a closed source OS as an open source one?
I'm sure on some level that's true, as you have the option to learn how, say, your WiFi drivers operate to decipher why your signal drops to three bars every 20 minutes.
However, in Windows, I generally know where to find configuration info: In one of three registry hives, which follow a pretty easy to parse tree structure.
In Linux, I'm totally lost finding where to configure different pieces of software. Each distro puts their various configs in different spots. Some in /etc/local/whatever, /etc/whatever/, /usr/share/local/whatever.d/, /opt/whatever/, /etc/opt/whatever.conf/, /usr/local/share/whatever.d/ and so on. Some times there are duplicates, which one is the correct one? How do I know? And on top of this, every config file uses different formats.
If you can get a reproducible case and capture enough useful diagnostic information you can give that to Apple to try to get a fix in some future version of OS X. Have a look at /usr/bin/sysdiagnose and /usr/sbin/spindump among other tools. I'm sure there are more diagnostic tools internal to Apple, which would require that you have a case that is reproducible from a new OS X install rather than from a system with files copied over. If you can identify the one file from ~/Library or wherever that triggers it, then you can pass that along as the repro case.
In general people (like me) just don't have the time to hunt down every crash, hang, etc. we find when using a computer. So I can understand if one doesn't bother with capturing diagnostics and repro cases or with downloading Darwin or Android source to debug a crash. I can also understand where huge frustrated discussions like this one come from. But deep down there is an answer, and it likely is not from some huge corporate failing on Apple's part.
Work for Apple.
Well, since you used "usually" and "some level", the same exact thing holds for OS X.
If THIS particular one doesn't make sense, it's because nobody bothered explaining the mechanism yet -- which should be trivial if investigated.
Isn't it obvious that "safe mode" boot foregoes running some system stuff? That probably lets some script the chance to fix something (bad permissions?) that it couldn't fix when the full system, sandboxing, mdworker etc were running.
Maybe the hardware problems is for the stereotypical consumer isn't interested in Linux if you compare to Windows and Mac OSX. Different story on server-hardware/software though.
It's just a general fact that, given enough time and some trial and error, one can make problems go away even without understanding the root cause. I don't think it varies so much from one OS to another.
I'm somewhat skeptical that this will fix the random beachballing, because I'm pretty sure I've been seeing that since before ML. The fact that I put up with it is testimony to how badly windows and (desktop) linux suck.
EDIT: tried the config edit and rebooted, not seeing the "deny mach-lookup" error any more but I am still seeing regular "Unable to talk to lsboxd" messages. I guess I'll try the safemode thing later.
EDIT2: another thing I've done in my quest to banish the beachball is to uninstall iStat Menus. I'm sure there are many others here who use it. It was causing lots of crazy behaviour in the SystemUIServer process. Now I've binned it, things seem better. It's a shame, I liked those graphs. Anyone know another tool that can show me per-process bandwidth usage?
This PDF goes into it in some detail: http://securityevaluators.com/files/papers/apple-sandbox.pdf
I guess the ugly UI of the thing should have been a warning.
It depends on how it's coded. And stat apps are notorious for using lots of resources.
Otherwise, a 2013 machine is a pretty tough beast performance wise, including running tons of highly demanding apps.
For people that know about DAWs, this video proves that the Retina MBP 15" is an absolute beast:
The only thing that causes my MacBook to run slow is Dropbox when it does its re-indexing. 100% CPU, really? Sigh...
To test whether you have the problem, open the Console (under Others in launchpad) and search for the string "mdworker".
Anyone else seen that? rMBP, fwiw.
Those freezes got a lot rarer after I disabled the dynamic pager [1]. I have only experienced it once since then.
I have had vm_stat and iostat running constantly to see if I can catch any metrics when it happens, but nothing stands out. It's not related to excessive I/O or swapping.
It happens all the time if I have an external keyboard plugged in and try to use the built-in keyboard or trackpad. It will often be non-responsive to input for about 5 seconds. Once both the keyboard and trackpad completely stopped working and I had to reboot (using the attached external keyboard). I noticed some USB errors in console once when this happened but didn't investigate.
I've also seen this when it's asleep and I try to wake it up. Often it will take 5 sec or more to respond and wake up.
I've found a handful of forum posts and support requests, but no solution other than "it's probably a hardware defect and you should return it".
(This hasn't recurred since the latest point release, so it may be fixed now.)
The "alternative fix" hidden text at least explains why booting Safe Mode might magically fix things; it's "rebuilding things and clearing caches". What a mess.
You get to decrypt the disk, safe boot, verify fix, then re-encrypt the disk. Apparently the boot loader can't pass a boot variable down after the transfer or something? Anyone have insight here?
I'm sure they did it out of incompetence and/or spite, and not due to some security concern or technical issue.
Without knowing MUCH MUCH more into the issue, I wouldn't call it neither oversight, nor incompetence.
cd /sbin
sudo mv fsck_hfs fsck_hfs_orig
sudo cp -p /usr/bin/true fsck_hfs
nvram boot-args="-x -v"
reboot, log in
sudo nvram boot-args=""
reboot
cd /sbin
sudo mv fsck_hfs_orig fsck_hfsBut just switching to single user (aka boot-args="-s -v") and manually running fsck_hfs -c 4096m -f -d /dev/disk1 (or equivalent) I managed to clean up / of a few problems in under 4 minutes. fsck_hfs looks like it could use some fixing to dynamically cache things better, that or they could give it default arguments based on the systems memory size to speed things along.
Either way I'm done with trying to fix this, just going to reinstall 10.8.3 from scratch and rsync over my home directory and reinstall vmware. I've tried about every fix for the sandbox nonsense, and since this system had 10.7 originally maybe it upgraded badly, whatever.
I am on a mid-2011 Mac Mini and I upgraded to Mountain Lion when it was released. Ever since I have been plagued with a freezing issue which is way worse than described by the OP.
What happens, 10-20 times per workday is the following:
I am in my workflow coding, sending e-mail, using Photoshop etc
At any seemingly random time, the app(s) I am using will become unresponsive
Soon after the Beachball appears and I cannot interact with most apps
After a period of time, usually between 10 seconds and 15 minutes (yes, minutes), everything un-freezes and goes back to normal
When the freezing happens, Chrome will not load webpages (stuck on "Waiting for cache" message). The Terminal will take forever to perform simple commands, such as "ls". TextMate will freeze when trying to save a file, or sometimes even when trying to input data. Finder will lock up totally.At times during longer periods of freezing, there is a small burst of CPU cycles going through, so if I type "ls" in the Terminal, the command might execute after 40 seconds and then freeze again.
I have searched the web high and low for a solution, but haven't even found anyone with the same issue.
I have tried booting into safe mode, re-installing ML, uninstalling software, tampering with settings, isolating the behaviour to a certain app etc. I have found that the freezing occurs even after a clean reboot without starting any apps. There is nothing in the system logs. There is no extra network, cpu, memory or disk activity at the time. I have not found a single thing to pin this on.
Using Photoshop, Parallels and Skype seem to make the freezing more frequent, but they are not solely responsible for it.
Has anyone even seen this issue? At this point I have mostly given up on a solution, I am just looking for that "Who are you DenverCoder9? What did you see?" moment[1]
Anyone?
How does that fix anything?
Because of that last bit, I've never taken her seriously. That laptop was working fine when I was using it for Photoshopping raw images while having 15 browser windows open...her use-case is literally to have something to check GMail with and sometimes listen to her iTunes collection. I've gone into the laptop several times to make sure there isn't bloatware on it, and have disabled every extraneous feature...and yet she still has the few-second freezes issue (and I've been unable to reproduce it)....Hopefully this is the solution to both of our problems.
I have a new (< 6 months) Mac Mini running ML and it's infuriatingly slow opening applications. It's not unusual to wait 10-15 seconds after clicking to open Chrome or Spotify (or anything else). My 5 year old MacBook does the same thing in a fraction of the time (running SL).
I mean, have you tried obvious things to find what's at fault? Like "Activity Monitor", "fs_usage" and such?
Have you checked if you have apps that install kernel hacks? Or some badly written memory hog app installed in the menubar to run all the time?
A < 6 months Mac Mini should have no such issues.
There's virtually nothing installed on the box - we stream pretty much everything and it's only used as a media center style machine.
I've made an appointment with the genius bar to see if they can shed some light on the issue.
And one of those terrible clear plastic mighty mice with the useless trackball. I'm quite surprised it's lasted this long given the beating she's given it.
I'm rather annoyed as it seems like a simple "housekeeping" task that OS X should have already handled. When upgrading the OS, Apple always re-hides my user Library folder and wipes out my TRIM support kext for my "3rd party" SSD, but they cannot perform clean up like this? Very disappointing.