46

I'm running MacOS Sierra on a mid-2014 MacBook Pro. About once/week, Safari’s CPU usage becomes very high, and it becomes very laggy. In the last instance I had just six windows open, none of which were playing videos, but Safari’s CPU usage was at 332%. In addition, even after closing all six windows, Safari’s CPU usage remained at a high level. I could only get it to stop by quitting and restarting Safari.

I got a Capture Data trace while it was happening, and sent it to AppleCare, where a senior advisor forwarded it to their engineering team. The response he got back was that it looks like I wasn't rebooting my computer often enough, which is necessary because the kernel expires (he recommends weekly, and I was rebooting it about every two months). As this was second-hand through the senior advisor, I wasn't able to get a more complete technical explanation. Further, I've not been able to find any official Apple documentation on this.

Can anyone give me a detailed technical explanation that elucidates what's actually going on here? I'm particularly curious if this is something particular to MacOS's microkernel (as opposed to monolithic kernel) design, and whether kernel expiration time is fixed based on wall clock, CPU time, etc. since last reboot, or varies based on certain factors. Thanks!

[I'll add that, from 2004-2009, I used a Power Mac G5, often running 10 applications w/ 10 windows each, as well as C++ programs that took weeks to finish, never rebooted except when needed for software updates, and got kernel panics less than once/year. But all three MacBook Pros I've owned (2008, 2011, 2014) have given kernel panics every month or two. I'm now wondering if this is because I'm not rebooting my MacBook Pros often enough — except this wasn't an issue with the G5.]

In case it's helpful, here's a screenshot showing the Activity Monitor during the event described in the first paragraph. Also displayed is the Intel Power Gadget readout; it seems odd that the CPU frequency is only 1.3 GHz (it's a 2.8 GHz Intel i7-4980HQ processor with a 4.0 GHz Turbo Boost) when a process is running at 332%. This behavior reminds me of (but is of course different from) thermal throttling of the CPU, where the system creates a fictitious high-load kernel task (typically ~>600%) to keep other processes from running, resulting in a low CPU frequency (0.8 GHz) (an example of thermal throttling is shown after). I didn't post these initially because I thought they might be a distraction from my core question about "kernel expiration" and weekly reboots, but have reconsidered given that forum members have disagreed with that explanation.

HIGH SAFARI ACTIVITY:

enter image description here THERMAL THROTTLING OF CPU (FOR COMPARISON): The thermal throttling on my current MacBook Pro is a separate issue from the kernel crashes, since I got the crashes even in the winter when I first got the computer and when there was no thermal throttling, and also got them with my previous two MacBook Pros as well. I've just posted this for comparison. [In case you're curious: The throttling occurs consistently when the discrete video card is being used (4K monitor attached) and the ambient temp reaches 83F; I've never gotten throttling when the monitor is disconnected. The computer is properly-ventilated; it sits on a raindesign mStand. The Apple engineer says it needs to be brought in for service to check the fans for dust, and for possible reapplication of thermal paste. It's under warranty, but I can't do that until I can arrange for a loaner.]

enter image description here


UPDATE, JUNE 23, 2017: I was unable to reconnect with the original AppleCare senior advisor, so I spoke to a new one who took over my case. He's been with Apple for about a decade, and said the following (I'm paraphrasing):

1) Weekly reboots. It's too strong to say they're required. Rather, they represent good practice. MacOS loads as much as possible into RAM to maximize performance and, if your computer doesn't use ECC memory (which only the MacPros do), errors creep in. Eventually, these can cause a kernel panic. How much time this takes varies greatly depending on your usage pattern. Some can get away with going a long time without panics, others can't. [It's not just how heavy your usage is, but also what you use. So one heavy user may be fine with infrequent reboots, while another, using different software, may need more frequent ones.] It's really about risk management. Rebooting clears the RAM, allowing it to start fresh. The longer you wait between reboots, the more errors accumulate, and the greater the risk of kernel panics. While one week isn't a specific guideline — indeed, there are no specific guidelines; you might use, say, two weeks — it's generally held within Apple that regular reboots are a good practice, for the above reasons. If you want to keep that risk at a very low level, weekly reboots are an excellent practice.

[My one observation: This doesn't explain why I didn't get regular kernel panics with my PowerPC which, while it can take ECC memory, can't make use of the ECC functionality—unless the PowerPC chip itself used memory differently from the Intel chip, even with the same OS.]

As to the server farm example that's been raised, this wouldn't be an issue for servers using ECC memory, such as the old Mac XServe. However the Mac Minis of course do not, so I'm curious how often https://macminicolo.net (mentioned by Matt Holland in a comment below) finds the Mac Minis they host in their server farm need to be rebooted.

2) Kernel expiration: He's never heard of this. He will contact the engineer for clarification, and should report back within about a week. I'll let you know what he says. As part of this, he will try to get a clearer answer on the Safari CPU usage (as I mentioned above, the Apple engineers have an actual data trace of this event, so they have good information on it).

FINAL REPORT ON "KERNEL EXPIRATION" (UPDATED JAN 9, 2018): I never got a reply from the new senior advisor about "kernel expiration." I did some research myself and found that, while it seems there is no such thing as "kernel expiration" in OSX, there are (as was also mentioned by Zan Lynx in the discussion, below) "kernel timers" that do expire (see http://www.sciencedirect.com/science/article/pii/S174228761500050X ). So my best speculation is that the Apple Care engineer was referring to kernel timer expiration, and that this somehow got lost in translation (to use Monomeeth's expression) between the engineer and the original senior advisor, thus morphing into "kernel expiration" when that senior advisor tried to relay it to me. Alas,even if so, I don't know why the AC engineer was concerned about this in relationship to my uptime.

EPILOG (JULY 1, 2018): Over the past seven months I've used my Mac both with and without the weekly reboots. I've found, consistently, that when I do the weekly reboots my Mac behaves well, but when I miss them wonky behavior begins to pop up. My conclusion is that, while it may not be generally true that Macs require weekly reboots, my specific configuration does.

My Configuration:

I have mid-2014 MacBook Pro 11,3 (2.8 GHz Intel i7-4980HQ & 1TB SSD w/ 4-lane PCIe link, formatted with APFS). During this entire time (since Jan. 2018) I've been running a clean install* of High Sierra with only the following non-Apple programs installed: MS Office, Mathematica, Logitech Gaming Mouse, Keyboard Maestro, Carbon Copy Cloner, Canon Printer, TomTom HOME, MacTeX (suite for using LaTeX), Firefox, Opera, Kindle, Copy Less, Size Up, Decelerator, TestGen, Turbo Tax, Flux, Launch Bar, and EtreCheck. [*I.e., I wiped the drive, installed High Sierra, and then installed the above programs.]

Further, prior to this (in Nov 2017), I brought the computer to Apple for warranty repair to address the thermal throttling and other issues. They found the thermal paste was indeed worn out, and replaced the entire motherboard, along with the battery (it was swollen), case, and trackpad. I've not experience thermal throttling since then.

My Mac spends most of its time at home, connected to a Logitech K811 keyboard and G502 mouse, and a Dell P2715Q 27" 4K monitor.

  • 10
    I only reboot for macOS upgrades, and I have much more stuff running than you do. So I assume something important got lost in communication here. – nohillside Jun 15 '17 at 4:03
  • 28
    If the tech you spoke to really tried to blame kernel panics on you not rebooting enough, he should be fired. macOS has become progressively less reliable over the years, and blaming its problems on users is fairly outrageous. A well-designed kernel almost never panics. Linux is a good example. – William T Froggard Jun 15 '17 at 4:34
  • 19
    "which is necessary because the kernel (or kernels?) expires (he recommends weekly" That is nothing but absolute pure BS! – user3439894 Jun 15 '17 at 4:47
  • 16
    "But all three MacBook Pros I've owned (2008, 2011, 2014) have given kernel panics every month or two." I can't repro this, or William Froggard's claim that "macOS has become progressively less reliable over the years." I've had both PowerPC-based Macs and a series of Intel-based MacBook Pros, and haven't noticed any stability regressions. If anything, macOS is more reliable than it has ever been. I've never had a kernel panic on my Late 2013 MBP (still in daily use), I restart it maybe four times a year, and I'm an extremely heavy user. You are being told a bunch of nonsense. – Cody Gray Jun 15 '17 at 9:27
  • 6
    There is no compelling argument AGAINST regularly rebooting your computer, and there are advantages to doing so. It's not about the OS, it's about the OS, the hardware, the device drivers, the third-party software installed, AND the specific usage patterns of the users. People need to stop acting like never rebooting is some sort of badge of honor. It's not. – barbecue Jun 15 '17 at 17:34
65

Documentation on this does not exist.

Having worked as a Certified Apple Engineer (CAE) I can tell you that something has most definitely been lost in translation (for want of a better word) from the original source (i.e. the engineering team) to the AppleCare adviser to you.

While it is arguable (opinions vary greatly) that regularly rebooting a computer (i.e. any computer) is beneficial, there is certainly no kernel expiry going on. And, as others have already stated, rebooting a Mac is only required for a limited number of updates/upgrades (e.g. firmware updates, OS level updates, hardware upgrades, etc).

I regularly have various Macs (including MBPs) running 24/7 for weeks/months at a time without any issues. So, being told that you don't reboot your computer often enough, which is necessary because the kernel expires, is nothing more than a figment of someone's imagination. Imagine if all those Macs being used as servers needed a weekly reboot - Apple would be the laughing stock of the IT industry!

My recommendation would be to research (and maybe post a separate question about) the issues you're having with Safari's CPU usage.

  • 6
    There are Macs designed for server usage? – JAB Jun 15 '17 at 18:13
  • 15
    @JAB Apple no longer makes a rack-mounted "server" but there are certainly Macs out there serving APIs and websites, take a look at macminicolo.net for example... – Matt Holland Jun 15 '17 at 18:53
  • 5
    @JAB There used to be one called the Xserve. Mac Minis are also widely used as servers. – Dmitry Kudriavtsev Jun 15 '17 at 19:30
  • 11
    It took Apple three versions to come to the conclusion that "format and re-install" isn't an acceptable procedure for changing a server's IP address. I wouldn't put it past them to require weekly reboots. – Mark Jun 15 '17 at 21:42
  • 2
    our first reaction at a major tech company when we saw the Mac Mini was "It's 1/4" too high". (racks are 1-3/4, Mac Mini was 2"). Since then, they have corrected that. – Harper - Reinstate Monica Jun 17 '17 at 2:40
24

As others have said, this doesn't sound at all like a reasonable response from Apple, and likely something is lost in translation. That said, monthly (or nearly so) kernel panics is definitely something "out of the ordinary". The fact that this has persisted across 3 different machines indicates either you have the worst luck with buying flaky hardware, or something common has been transferred from machine to machine.

I'm assuming you haven't been transplanting RAM chips or HDDs from laptop to laptop, so that leaves either software or some external device. If every new computer you've used TimeMachine or Apple's built in transfer software to migrate your environment, it's possible that some software issue is being propagated each time you upgrade machines. Unfortunately, the only "quick" way to validate this is to boot from a clean installation and use that until you're confident the problem no longer persists. If you have an external drive you can use, this is a possibility for you, but otherwise, you would need to back everything up and completely reinstall without restoring the backup, which may be more effort than you want to take. It's possible it's hidden in user preferences in which case creating a new user account and using that might help, but in my experience it's about 50/50 whether it's a user level issue or a system level issue.

Assuming you don't want to go through those steps, I would try to determine what each kernel panic has in common. If they all seem to happen and coincide with your safari issues, then that narrows it down to a likely issue in safari. You can either try using a different browser for a few months and see if the issue disappears, or try eliminating any plugins/third party addons that you have installed in safari. If the issue persists, runaway CPU usage strikes me as runaway process likely due to some software bug interacting with some ad or other tracking/javascript that is on the sites you're using. Once you've eliminated all of the various plugins as the cause of the issue, you could try installing an ad blocking plugin, preferably one that can block javascript too and crank its restrictiveness to max. This may make some of your browsing less enjoyable (and may even break some sites you use) but these sorts of plugins also allow you to turn off the blocking on a site by site basis, so over time you can relax the restrictions until you find the site that's causing the issues. From there you will have a better starting position for determining exactly what's giving you trouble.

If the kernel panics occur even outside of safari usage, you may be looking at your safari problems being caused by whatever is causing the kernel panics, in which case you want to tackle that before you try to figure out safari.

External devices can also cause kernel panics if they're not behaving correctly. So if you use an external HDD or something else commonly plugged into your USB or other expansion ports, try seeing if not using that device clears things up. Even something like a USB thumb drive can cause issues. It's not a common thing, but then again, neither is monthly kernel panics. Alternatively, if you always use the same port for the device, you could try a different port to see if it's an internal hardware issue, but this is less likely given that the problem has persisted across multiple machines.

  • I remember doing clean installs at least twice: start with just the OS, install the latest versions of all the applications from the Apple Store or the developers' websites, and then copy over my data folders (that process takes about two 8-hour days). I once tried using Time Machine for this, found it too buggy, and started over using the above method. – theorist Jun 15 '17 at 16:13
  • You are correct that external devices can cause kernel panics. The one exception to the rock-solid behavior I described for my MacPro was a year during which it panicked repeatedly. Working with Apple, we traced it to the backup software that came with the Seagate external HD (software designed for the Mac!). After removing it, the problem disappeared. I've thus been careful never to use any Seagate (or WD) backup software since then (I use Carbon Copy Cloner) [continued next comment....] – theorist Jun 15 '17 at 16:16
  • 5
    Whenever I hear about a Mac with lots of kernel panics I ask if they have Adobe software installed. The answer is always yes. Just sayin... – barbecue Jun 15 '17 at 17:36
  • 1
    @moneyt I didn't copy over any Library files, except for my Safari bookmarks; I just let the applications create fresh versions of these these. Otherwise it was documents, pictures, music, emails, etc., along with (IIRC–I can't find my notes on this) parts of /usr/local related to LaTeX. I don't use anti-virus software or tech tool pro, but I do use Adobe CS. I suppose if I wanted to address the kernel crashing directly, I'd do a separate post with a recent crash report (I haven't saved any recently). – theorist Jun 16 '17 at 3:58
  • 1
    @theorist To me it seems that part of the response you got from Apple (i.e. the it looks like I wasn't rebooting my computer often enough part) was an attempt to deal with the symptom rather than the cause. The advice offered by moneyt and others here is useful, but I suggest you should ask a question specifically about your Safari CPU issues (and perhaps another question about your kernel panics after the next one happens - although the two may be related). That way the community can try helping you more specifically, as we have no idea what else you've tried (besides calling AppleCare). – Monomeeth Jun 16 '17 at 7:11
15

I'm not sure who you talked to at Apple, but Macs, like all Unix-based devices, do not require routine reboots, except for certain updates.

As for the kernel, it is the heart of the operating system. There can be only one™. It should have nothing to do with your problem here. If Safari has runaway CPU usage, I'd try deleting its caches first. While in Safari, click on the Safari menu, select Preferences, select the Privacy tab, select "Manage Website Data...", then finally select "Remove All". Note that you'll have to log in again to some websites, but you won't lose anything crucial.

  • I've done the "Remove All" a few times, to no avail. I'll see if I can get the senior advisor to send me the exact wording from the Apple engineer. – theorist Jun 15 '17 at 4:24
  • & thanks, I've edited my post to remove the plural "kernels" – theorist Jun 16 '17 at 0:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .