9

Since a week or two I am experiencing a very strange problem on my MacBook Pro running macOS 10.14.6 Mojave. (Build 18G103)

No matter what I'm doing, typing something in a browser or text editor or other application, watching a video on youtube or in VLC, every few minutes the whole system become non-responsive for like 1 or 2 seconds.

When the machine is "stunned":

  • The keyboard does not respond to typing in any app
  • video playback stops no matter which app or browser
  • mouse clicks don't register
  • cursor movement does work and respond
  • any sound that is playing, keeps on playing normally.

    When I was typing something, the letters don't appear, but after 1-2 sec when the system continues, the letters still appear as if they were cached somehow.

This persists across reboots, activity monitor shows no fancy stuff taking CPU in the background. I did not recently install any particular new software myself, other than just updates. It makes no difference if I have multiple apps running or only the one I'm using.

Is there any way to find out what application or process is causing these short freezes, and preferably get rid of them?

2

I've seen precisely this problem on many, many versions of macOS, both release and beta. Usually the delay is caused by some Apple process. For me, diagnosing is not the problem, the problem is fixing it.

You didn't say how much memory your computer has. A few years ago, Apple introduced compression on virtual memory. This is especially important in SSD-based computers: it decreases wear on the SSD to just compress memory, rather than sending it out to mass storage. But more and more programs are using more and more memory. So most of the freezes I've seen are related to long-running processes, typically Apple's processes used for things like curating photographs or background indexing of the SSD, waking up, having lots of memory decompressed, making the program you are using have its memory compressed, and then the scheduler changing its mine and giving your program memory. One of the related problems is that the Mach process scheduler doesn't seem to be as memory and swapping aware as it should be.

Your question is about how to diagnose this, so here's what I do:

  1. First thing I do is set my system clock to count every second so I can always look up at the menu bar and see if the computer has crashed.
  2. Next, I set up a program that does a ps aux every second and stores the result in another file.
  3. I use the computer until it freezes.
  4. Then I look at the relevant ps aux to see which process was taking up the most memory or the most CPU.

If you are pretty sure you have identified the process, you can STOP it without killing it. See if this makes the problem go away.

Once you've identified the culprit, you have a problem. It's typically an Apple process, not your own, not a third-party driver, not anything that you have control over. Here are some of the things I've tried:

  1. Create a new user on your computer and try using it without copying over all of your files. Does the problem go away? If so, it's either that your profile is corrupted or, more likely, a file in your profile is causing the problem. Now you can slowly copy things into the new profile until you have identified the problem.

  2. Sometimes I've found individual files that causes the full-text indexing program to blow up the amount of memory it needs or to crash. I delete those files and the problem goes away.

  3. Sometimes I just wipe the computer and restore my files. That works.

Good luck. This is annoying and it's almost certainly apple's fault.

1

Does your Macbook have a physical HD or a SSD? In my experience, these sound like the symptoms of imminent HD failure: your computer is trying to read/write to disk, but it can't because the HD is accessing a bad sector and can't read/write to it, so everything freezes until the HD responds.

If you actually have a physical HD, the way to check this would be to check the SMART status. The "standard" way to do this would be using Disk Utility; unfortunately, it won't tell you much. In most OSes (Windows too), the OS-level tools to check on hard drives will just tell you "SMART status: passed"... right up to the moment the HD fails.

In my experience, the only reliable way to check the SMART status (including the most important stats: bad sectors, reallocated sectors...) in macOS is to use Homebrew to install "smartmontools", an Unix command-line program to check the SMART status of your HD. Forther details in this question:

How do I get detailed SMART disk information on OS X (Mavericks or later)

If you do this and see that stats like "Uncorrectable Sector Count" are higher than 0... backup your data immediately. And change the HD.

  • It would have to be a really old MacBook Pro to have a HDD, but since you added precisely how to diagnose a failing HD +1 – bmike Nov 16 at 22:44
1
+50

Let's start with some basic troubleshooting steps and we'll see how far we get.

The first thing I would do now is test your MBP in Safe Mode.

Boot into Safe Mode

Follow these steps to boot your MBP into Safe Mode:

  1. Fully shut down your Mac
  2. Restart your Mac
  3. Immediately press the Shift key and keep it down
  4. Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
  5. Now use your MBP in Safe Mode until it starts showing the freezing symptom again or until you're satisfied it's not going to
  6. Exit Safe Mode by restarting your Mac as normal
  7. Once again, test to see if your MBP still freezes

Now, if you find that your MBP:

  • works fine while in Safe Mode, but not when booted normally, then it's likely to be a login item, corrupted font, or kernel extension). If so, read on further below.
  • still freezes, then it's time to skip ahead to resetting SMC, NVRAM and potentially testing your hardware. If so, let me know your exact model of MBP and I'll add the steps to this answer.

Investigating login items, fonts, and kernel extensions

Let's start with Login Items:

  1. Startup normally
  2. Go to System Preferences > Users & Groups
  3. Select the Login Items tab
  4. Take a note of your Login Items
  5. Now remove all of them by highlighting them and clicking on the - button below
  6. Restart your computer

Now your Mac will boot up without those login items loading. Test to see if you can use your Mac without it freezing:

  • If you can, you know one (or more) of the Login items were causing the problem. You can then add them back in one by one until you've identified the culprit. Problem solved.
  • If the problem does persist, it's either a problem with fonts you've installed yourself or with a 3rd party kernel extension. A little more info below:

Fonts:- You can remove any of the fonts you've installed yourself to see if this makes a difference.

Kernel Extensions:- You can open Terminal (found within your Utilites folder) and enter the following command:

kextstat | grep -v com.apple

The above command will list 3rd party kernel extensions (you may need to stretch the Terminal window so it's easier to read). Look for anything you don't remember installing, or something that belongs to software you've removed, or just anything that looks out of place. Remember though, this is a list of 3rd party kernel extensions and therefore any of them could be causing the problem.

You must log in to answer this question.

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